Trying to make sh file
can the following line be turned into a script file?
let x=10;while [ $x -gt 0 ];do clear; figlet $x;let x-=1;sleep 2;done
Just started learning Bash and every time I try to run this file it comes back with the error:
figlet.sh: command not found
i did make it excutable. Also tried putting ./ in front of file. If it can be done just give me a hint on what I need to look at. Thanks
For a script to run there are three things that need to be done.
1) In the script itself it must start with a special comment (referred to as the she-bang line or hack). This is a comment line in the script as the first line:
This tells the program that reads and runs the script (in this case bash which is found in "/bin/bash").
2) The permissions need to be changed to allow it to be executed. Here some examples of changing the permissions of a file:
3) Place the file in a directory that you have added to your PATH environment variable or include the path when executing the script (or program binary if using C, C++, FORTRAN, ADA, etc).
chmod 755 filename
chmod u+x filename
Had done all that. The file is in my home dir. If I right click on the file from the desktop I get the option to run in terminal and it runs as it should. But from inside terminal in my home dir and typing the file name I get that error message. Doing the ls command does show the file being there. Thanks for your help.
If you would like to run your file in terminal then you need to cd to the folder then type: "./script.name" and that should run your script.
open a terminal and run your script from there.
Thanks for all the in put---SOLVED---http://www.linuxforums.org/forum/images/smilies/icon_biggrin.gif