The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem when passing argument to a shell script sumesh.abraham Shell Programming and Scripting 9 12-13-2006 12:07 PM
printing last argument in shell script arunkumar_mca Shell Programming and Scripting 5 10-03-2006 09:32 PM
Argument list too long - Shell error dad5119 Shell Programming and Scripting 8 03-03-2006 03:57 PM
shell script argument parsing rmjoe Shell Programming and Scripting 1 07-28-2005 04:37 PM
shell: creating different arrays based on function argument nix21 Shell Programming and Scripting 5 03-20-2005 11:34 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-24-2008
painulyarun painulyarun is offline
Registered User
  
 

Join Date: May 2007
Posts: 2
Shell script $0 argument

Hi,

If not running a shell script file in current shell (. ./fileName) then $0 represents the executable file name. But in case of invoking shell script file in current shell then i m getting "$0 as -bash" . In such case how can i get the program name (running shell script file name)?

Thanks,
  #2 (permalink)  
Old 03-24-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Sorry, you can't :/
As far as I know, it's a shell builtin so it won't even be present on the process table.
  #3 (permalink)  
Old 03-25-2008
ShawnMilo ShawnMilo is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 252
Right, you can't. The thing is, you're not executing the script when you call it like "bash scriptname." You're executing bash, and bash is using that file as input.

This is why you can still run "bash scriptname" when the file doesn't have execute permissions set.

ShawnMilo
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0