why the script name not displayed and not sh invoked?
Say there is a shell script named test.sh. I intentionally omit the #! line in test.sh for testing perpose. I did the following :
$ echo $0
-ksh ---> current shell
$ echo $$
12919 ---> PID of the current shell
$./test.sh
----> test.sh contains a sleep command to prevent it from terminating immediately
Then I switched to another terminal session to continue my testing:
You can see that the process id associated with the script test.sh is 5083.
Questions here:
1. Why shell itself displayed in the process list without test.sh as the argument? We usually expect " -ksh test.sh " displayed. My another testing shows that the argument test.sh can be displayed if #! line added in the script.
2. Why the invoked shell is ksh instead of ssh? To my knowledge,, if #! line not specified explicitly, the default shell, i.e. sh is used as the interpreter .
Thanks!
Last edited by Yogesh Sawant; 03-30-2009 at 11:40 AM..
Reason: added code tags
Hi,
When I invoke a script s1.sh it will call an another script s2.sh by itself. This script s2.sh will call some java files, so while running the script it asks for a file name to be processed. Which we can see in the screen.
The file name to be processed is present in script s1.sh
Now... (1 Reply)
Hi,
When I invoke a script s1.sh it will call an another script s2.sh by itself. This script s2.sh will call some java files, so while running the script it asks for a file name to be processed. Which we can see in the screen.
The file name to be processed is present in script s1.sh
Now I... (2 Replies)
Hi,
I have the following script -
fixpart="/files/myScript # Transfer Script"
echo "Specify the transfer frequency in minutes - "
echo "every 1, 2, 3, or 5 minutes (default every 1 minute) "
echo $nn "Frequency ? :" $cc
read ans
case $ans in
2) echo... (9 Replies)
Hi ,
I am new to shell scripting.
I am using Linux for doing scripting.
Below is my script, which takes 2 parameters as input.
test.sh has the below:
#!/bin/bash
. $HOME/.profile
gpg --yes --no-use-agent -r "$(eval echo \$$2_Var)" -e $1
1st parameter is command line... (7 Replies)
Hi All,
I have two scripts - ScriptA and ScriptB
ScriptA has logic to invoke ScriptB :
- with some parameter
- or without any parameter
ScriptB can also be invoked by the user from the command line.
Is there anyway to ensure that when I execute ScriptB from the command line, it does... (3 Replies)
I have an investigation job at hand where I have to know when was the FIRST time the daemon was invoked.
Now, currently what I can see as the time since invoked was some where near the last reboot which is kind of obvious that the daemon stopped and recycled after reboot.
But I want to know the... (6 Replies)
-EDIT-
I have solved my problem below by using a different program. Instead of xsel I am using xclip which basically does the same thing and works fine from a script invoked by a global hotkey.
-END EDIT-
Hi,
I've written a simple script to copy my email address into both the... (0 Replies)
hi gurus,
I have tried myself to invoke an oracle function. there are three different function available need to be called for differnt. can you tell me whether the below code is correct to call oracle function from shell script.
Any help would be highly appreciated.
cat location.sh
... (5 Replies)
In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ?
--- Post updated at 08:39 AM ---
in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)