Shell scripting.
Hello everyone,
I am completely new to linux and i know few terminal commands and i have fedora 13 installed. I am working on shell scripting. I am writing the script in vim-X11. Am i doing the rite thing??. And I've no idea how exactly to run that script after saving it. Kindly Help. Regards... |
This might be useful for you.
Shell Scripting tutorial As for using vim-x11, some prefer vi/vim and others emacs. It is a matter of preference. Just use what you are comfortable with. |
you will need to set the script's execute permission
Code:
chmod u+x script.sh Code:
./script.sh Code:
bash script.sh |
Any plain text editor is fine for shell scripting. After you save the script just set the executable bit and call it directly from the terminal.
Code:
$ chmod 'u+x' your-script |
Sounds fine to me :-). You might try running vim just in the terminal so you can get used to non-graphical applications. You might also want to look at some of the bash guides at www.tldp.org to get some basic ideas about shell scripting.
You save your script as a text file, and you can run it by: Code:
bash filename.sh Code:
#!/bin/bash Code:
$ vi filename.sh # create the script BTW, you might consider upgrading your Fedora at some point. I believe that 13 is a bit out of date. |
Quote:
|
Thanks!!
Thank you all.!
$ bash hello.sh worked perfectly. That was my first script.:-) |
If you just want to test your script without making it executable just give the command
Code:
source script name |
Open Terminal or Konsole or whatever, it depends on what distro and what DE you're using, run the command;
Code:
man bash Code:
man whatever That's for start. Then check these 2 links, in that order (second one is something btmiller suggested); http://linuxconfig.org/Bash_scripting_Tutorial http://tldp.org/LDP/abs/html/ |
All times are GMT -5. The time now is 06:46 PM. |