Shell execution


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell execution
# 1  
Old 03-17-2011
Bug Shell execution

hi,

Pls bare with me if this is trivial.

Is it possible to run a korn shell with out specifying the name with its extensiion?

Quote:
./shell1.sh
. shell1.sh
Quote:
shell1
Do i need to make any changes to the script make it work?

Thanks
# 2  
Old 03-17-2011
rename the script OR create a shell alias.
# 3  
Old 03-17-2011
Yes. The directory containing the shell script should be placed in $PATH if it is not there already.
For example:
Code:
PATH=$PATH:/home/my_scripts_dir    ;    export PATH

The script file itself should have execute permissions and contain a shebang line on the first line which points to the Shell required:
For example.
Code:
#!/bin/sh


A Shell script (or any other unix file) does not have to have any particular extention. A full-stop character in a unix filename is just another character. You will notice that the command "ls" for example is not "ls.exe" or whatever.

File extensions have special meaning in some other operating systems like Novell Netware or Microsoft Windows.
# 4  
Old 03-17-2011
Quote:
Originally Posted by dvah
Do i need to make any changes to the script make it work?
You will always have to give the full filename, UNIX will never add an ".sh" onto the end for you. Filenames really don't mean anything to UNIX, and it doesn't have extensions as such, it's all just one string.

But since it doesn't care what the file is named, you can just rename it to "shell1" without any extension and it'll still work.

If you want to run it without specifying it's location too, make sure it's in your PATH as methyl says.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execution of Shell Commands

I have a question: Where would I put the Command line (of any command) so that it executes every time I log on? Where would I put it if I want it to execute every time I start a new shell? (5 Replies)
Discussion started by: Nabeel Nazir
5 Replies

2. Shell Programming and Scripting

Shell Script execution issues

Hi, There's a shell script by name "download", which has been created as user "mgr" and that script needs to executed as user "dev". I tried giving privileges 701 on the script download. But it's throwing the error message bin]$ ./download /bin/bash: ./download: Permission denied ... (6 Replies)
Discussion started by: venkatesh17
6 Replies

3. Shell Programming and Scripting

For loop like execution in shell

Hi, In the script that i work now, I wrote the script such a way that the values retrieved using a tcl script is passed into a shell script to specify the path where the specific file needs to be sourced exists. For eg: I got a path from the tcl script given below, ... (6 Replies)
Discussion started by: shivashankar_S
6 Replies

4. Shell Programming and Scripting

execution of aliases from shell script

Hi I have to execute the commands in .aliases file from a shell script I tried 1.giving the alias directly in shell script 2.Giving the actually "value of alias" in the shell script 3. I tried giving both steps 1 and 2 inside ` quotes Still nothing is working . It says command... (3 Replies)
Discussion started by: ssuresh1999
3 Replies

5. Shell Programming and Scripting

automatic execution of shell script

Dear All, I want to execute a shell script,whlie system is booting. I was try using /etc/rc.d/rc.local file but its not working. (1 Reply)
Discussion started by: rajamohan
1 Replies

6. Shell Programming and Scripting

shell execution time calculations

I am writting a script in the ksh shell and am trying to find a way to report the total execution time of the script without requiring the user to specify the time function when executing the script. Does anyone have any examples they have used. I have been setting up two date variables (one at... (1 Reply)
Discussion started by: Omar Bacha
1 Replies

7. Shell Programming and Scripting

problem with shell script execution

Hi All, i am running a shell script in which there is a command `ps -ef | grep smon > db` When i execute this command in the command prompt i am getting the desired output..but when the script is executed..the db file is getting created but with no values...I could not find the reason for... (2 Replies)
Discussion started by: anju
2 Replies

8. Shell Programming and Scripting

Questions on shell execution

Hi, I have a question regarding Korn shell script execution in HP-UX 11.11. What sort of environmental settings do I need to run a Korn shell script such as below without entering "./" at the begining of the command? cat test.ksh date I am able to do this with a user called infodba who... (6 Replies)
Discussion started by: stevefox
6 Replies

9. Shell Programming and Scripting

Please help on shell scripts execution

I have already posted the question. Because previous post has sinked so that I have to ask the question again. I created the script and chmod it as 755. The ksh shell is in bin. Now I typed ./script_name.ksh to execute the script in the directory of that script. The return message was: Ksh:... (13 Replies)
Discussion started by: duke0001
13 Replies

10. Shell Programming and Scripting

execution of shell script

How can I execute another shell script from one? Malay (5 Replies)
Discussion started by: malaymaru
5 Replies
Login or Register to Ask a Question