variable help in bashForum: Programming and Scripting Topic: variable help in bash started by: plinej Posted by plinej on July 18 2006,18:58
How would I make a variable equal to a chain of commands in a bash script?I made a rather lengthy bash script but would like to shorten it up by somehow making a variable equal to a chain of commands that repeats itself numerous times in my script. Here's one of the few chain of commands I'm talking about: echo "---------------------------------------------------" >> "$DVDARCHIVE"dvd-"$num"/moved.txt; echo "" >> "$DVDARCHIVE"dvd-"$num"/moved.txt I tried googling but I couldn't figure out what I needed to do. thanks for any help! Posted by mikshaw on July 18 2006,20:15
To make the output of a single command into a variable:
However, I think a function is more appropriate in your case, if you want multiple commands in it:
Posted by plinej on July 18 2006,20:44
thanks again mikshaw! A function is what I wanted.
|