Open a terminal and type:
vi (name of the script)
For example "testscript".
This will create a script named testscrip.
vi testscript
vi editor will open.Now its time to start writing your script. Below is an example of a basic script that launches Firefox:
#!/bin/sh
echo “welcome”
firefox
Save your script by pressing Esc.
Then:
Type :w
Quit vi by:
Typing :q
Next type the command below to make the script executable:
chmod +x testscript
Finally to run the script type:
./testscript
That's it! Enjoy creating scripts!
No comments:
Post a Comment