jack
jack

Reputation: 163

c shell script explain

I am completely new to scripting. Can someone please explain to me what's going on here? Thank you.

echo 'Report 1' > ${TMP}/reports.tmp
uuencode ${DATA}/${ext1} ${ext1} >> ${TMP}/reports.tmp

Upvotes: 0

Views: 247

Answers (1)

bmk
bmk

Reputation: 14137

TMP, DATA and ext1 are variables whose content can be accessed by $TMP, $DATA and $ext1 or ${TMP}, ${DATA} and ${ext1}

echo is a command to print a string to standard output

uuencode is a program to encode a binary file into an ASCII representation (might be e.g. needed to transfer the content of a binary file via mail)

> means redirection of standard output into a file (overwriting the file)

>> means redirection of standard output into a file (appending to that file)

echo 'Report 1' > ${TMP}/reports.tmp creates the file reports.tmp in a directory specified by variable TMP and writes the string "Report 1" into it

uuencode ${DATA}/${ext1} ${ext1} >> ${TMP}/reports.tmp appends the uuencoded version of the file ${DATA}/${ext1} (i.e. directory specified by variable DATA, filename specified by ext1) to reports.tmp

Upvotes: 1

Related Questions