ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
hi all im dipping toes into the shell scripting world and im already lost. i reading a book its upstairs at moment but im confused i thought shell scripting was all done in shell not in say anjuta for example? i am somewhat familar with C code but this has just lost me. i did create a file it told me to i think it was called "logins" and i only have 3 lines in it not really sure what im doing. i guess my question should be "how do i kno wwhen to put it in terminal or when to put it in program (kdevelop,anjuta).
If you are trying to run commands that would normally be run from the shell then you can easily put them into a bash script to be run over and over again. The first line of a bash script must start with;
Anything after that will mostly be commands you can run from a bash prompt. After creating the file you also have to add the executable flag to the script file.
chmod +x filename
will do this for the user who created the script. Then if you want to run the script at set intervals you can have it run in cron or from a command promt type ./filename if you are in the directory holding the file and that directory is not in your path.
The only thing I'd add to the above, is that the #!/bin/bash is a good idea, but FYI, if you don't put it in, the system will use whatever shell is defined in the user's login entry in /etc/passwd.
On Linux this is usually /bin/bash
Hence, you won't always see it specified explicitly in other's code.