![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Making Executable File | laxman123 | AIX | 0 | 06-12-2008 11:06 AM |
| How to make a script executable by all users? | chrs0302 | SUN Solaris | 2 | 10-18-2005 09:46 AM |
| pls hlp: making .sh files executable | ropers | Filesystems, Disks and Memory | 2 | 07-29-2002 02:44 AM |
| How do I make a cgi script World-executable | tylerl | UNIX for Dummies Questions & Answers | 2 | 06-13-2001 02:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Making UNIX script executable
Hello,
I am very new to UNIX and I have been learning about writing scripts and making them executable. I created a script called myscript. It has three lines: #! /bin/sh # This is my first shell script echo friendsjustfriends Now I try to run it using the sh command and it works Next I try to make it executable and it fails: #! /bin/sh # This is my first shell script bash-3.2$ chmod u+x myscript bash-3.2$ pwd ; echo $PATH /Users/rohit /usr/local/bin:/Users/rohit/bin:/usr/bin:/bin:/usr/sbin:/sbin bash-3.2$ myscript bash: myscript: command not found I do not know why it is not working. If there is something wrong with the path, please let me know how to correct it. Thank you so much! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Run it with ./myscript as its not in your PATH
|
|
#3
|
|||
|
|||
|
Thanks for your email.
How do I put in my path so that I do not need to use ./ to run it? Thanks, Rohit |
|
#4
|
|||
|
|||
|
You should start searching the forums. These had been answered many times before.
Anyway, here is a hint. PATH=$PATH:/home/user/scripts/ |
|
#5
|
|||
|
|||
|
It's better practice to not put ./ into the PATH variable. Becuase it might be too confusing.
|
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|