Results 1 to 10 of 15
i have a bash shell scripting code
Code:
$ vi sayH
#
#Script to read your name from key-board
#
echo "Your first name please:"
read fname
echo "Hello $fname, ...
- 06-13-2008 #1
linux bash scrupting error
i have a bash shell scripting code
when i run this from console i get the output with one errorCode:$ vi sayH # #Script to read your name from key-board # echo "Your first name please:" read fname echo "Hello $fname, Lets be friend!"
secondly i wanna know that is there any advantage of learnig linux bash shell scripting or it is useless.Code:./test line 1: $: command not found Your first name please: Ahmed Hello Ahmed, Lets be friend!
- 06-13-2008 #2
hi,
at the very beginning of your script you should put
to tell the computer how to run your script.Code:#!/bin/bash
regarding shell script its very useful if you wanna keep using Linux(or Unix by the way) as it will help you automate thingsLinux and me it's a love story
- 06-13-2008 #3
Is the line:
in the file? If so that is what's causing the error. Just comment out this line by putting a # at the beginningCode:$ vi sayH
Linux User #453176
- 06-13-2008 #4
thanks khafa for reply can u please tell me any site wh shows how can i automate my linux os.
thanks
- 06-13-2008 #5
automating things in Linux is a process that depends on who is doing it. so im afraid there is no rule of thumb. there is one book that is quite interesting (but you need to know about scripting before you can attempt to automate things), the title is "wicked cool shell scripts". it will give you very good ideas about how to automate things
Linux and me it's a love story
- 06-13-2008 #6
yes keren
is in the file.Code:$ vi sayH
i got this code from the following link
Code:http://www.freeos.com/guides/lsst/ch02sec10.html
- 06-13-2008 #7
i followed the link to see and what the guy meant is to open the file sayH with vi which gives
then you put the content(do not put the vi part in the file).Code:vi sayH
and put what follows at the first line(it can help you avoid some headache)
Code:#!/bin/bash
Linux and me it's a love story
- 06-13-2008 #8
oh k Khafa thats great
tell me is there IDE for shell scripting or i have to use knosole to run shell scripting.
- 06-13-2008 #9
i dont think you need any IDE to write your shell scripts as they are plain text files.
you just open a text file you put the instructions in there, then you save and make it executable(if you want) and run it. thats all
run the following command and it should give you many files in your system and you can open them with more or less to see how they are written.
Code:find / -type f -name "*.sh" 2> /dev/null
Linux and me it's a love story
- 06-13-2008 #10
so u wanna say that the code must look like this
but i have one questionCode:#!/bin/bash #$ vi sayH # #Script to read your name from key-board # echo "Your first name please:" read fname echo "Hello $fname, Lets be friend!"
what was the reason to include the commented line
#!/bin/bash


Reply With Quote
