To directly display the output from a command in a bash script (do not forget to set executable on the file $chmod u+x bashtest.sh) Where bashtest.sh is the name of the script file.
#!/bin/bash
#List home directory (note the back ticks)
echo `ls -l ~`
#Store command output as a variable
i=`ls -l ~`
echo $i
Twitter Updates
Tuesday, 28 October 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment