Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ help with script

Posted by: chaybird001 Apr 1 2012, 01:22 PM

Hi,

I am very new to linux and I can't figure out why my script cannot run from a different file location. I think I am missing something in my script, but I am not sure. Here is what I have so far.

#!/bin/bash/home/cs2165/cs216523

while true
do
echo "$(date)" |tee -a mylog1
echo "meeting at"; date '+%H:%M'
sleep 5

done


I recently added home/cs2165/cs216523 because I thought that was need to run my script from that location.
Please help.

Posted by: michaelk Apr 1 2012, 04:33 PM

#!/bin/bash tells the terminal what interpreter to use.

If the directory where mylog is located is not in your path environment then the script will not work. You can add a statement to change to the directory like
cd /location/of/mylog1 before the while. Be sure to use the actual path.

Posted by: Javi12Alvares Oct 12 2017, 02:15 AM

I am also new at Linux maybe you can help me.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)