Call stack /bin/sh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Call stack /bin/sh
# 1  
Old 03-01-2017
Call stack /bin/sh

call stack shell

Last edited by julia_sus; 03-02-2017 at 07:26 AM.. Reason: Changed ICODE to CODE tags.
# 2  
Old 03-01-2017
If you need BASH features, use BASH. I don't think you can do that in plain Bourne.
# 3  
Old 03-01-2017
I have to second Corona688 in that sh doesn't provide that.
But, you could exploit the local variables' features to build sth. alike of your own:
Code:
foo()
{ local FUN="foo $FUN"
echo $FUN
}

fooin()
{ local FUN="fooin $FUN"
echo $FUN
foo
}

FUN=$0

foo
foo sh

fooin
fooin sh
foo fooin sh

These 2 Users Gave Thanks to RudiC For This Post:
# 4  
Old 03-02-2017
Thanks Rudic for this helpfull tip,

Last edited by julia_sus; 03-02-2017 at 07:27 AM..
# 5  
Old 03-02-2017
If a function called "main" is the caller, it will show up. In above, there is no "main"; sh as the basic shell is the caller, assigned to FUN when we do FUN=$0. Make that FUN=main if need be.
This User Gave Thanks to RudiC For This Post:
# 6  
Old 03-02-2017
Thanks Rudic for this helpfull tip,

Last edited by julia_sus; 03-02-2017 at 07:27 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Usage of #!/bin/sh vs #!/bin/bash shell scripts?

Some question about the usage of shell scripts: 1.) Are the commands of the base shell scripts a subset of bash commands? 2.) Assume I got a long, long script WITHOUT the first line. How can I find out if the script was originally designed für "sh" or "bash"? 3.) How can I check a given... (3 Replies)
Discussion started by: pstein
3 Replies

2. UNIX for Dummies Questions & Answers

View User Mode Call Stack of Hung Process

I have a multithreaded usermode program(actually a daemon) which is in hanged state. To debug it I tried attaching the process to gdb, but the gdb hangs. gstack also gets hanged. I peeped into the proc file system and saw the process to be in sleeping state. /proc/sysrq-trigger I guess... (1 Reply)
Discussion started by: rupeshkp728
1 Replies

3. Shell Programming and Scripting

Possible to use /usr/bin/watch to call a function?

I want to have a script both define functions and have the ability to run an external program calling one of them. This is the simplified construct: #!/bin/bash foo() { echo "this is foo" } bar() { echo "this is bar" } case "$1" in one) foo ;; two) export... (1 Reply)
Discussion started by: graysky
1 Replies

4. OS X (Apple)

When to use /Users/m/bin instead of /usr/local/bin (& whats the diff?)?

Q1. I understand that /usr/local/bin means I can install/uninstall stuff in here and have any chance of messing up my original system files or effecting any other users. I created this directory myself. But what about the directory I didn't create, namely /Users/m/bin? How is that directory... (1 Reply)
Discussion started by: michellepace
1 Replies

5. Shell Programming and Scripting

Call Nice command (priority) from /bin/ksh

Hello, I am just starting with shell scripting, as everyone will soon see from my question. What I'm trying to do is call the Nice command to set the script process priority from /bin/ksh. The difference is I'm running it not directly through the shell, but through Bigfix (very similar to... (3 Replies)
Discussion started by: solly119
3 Replies

6. UNIX for Dummies Questions & Answers

fuser: difference with bin/sh and bin/ksh shell script

Hi, I have a problem I don't understand with fuser. I launch a simple shell script mysleep.sh: I launch the command fuser -fu mysleep.sh but fuser doesn't return anything excepted: mysleep: Then I modify my script switching from #!/bin/sh to #!/bin/ksh I launch the command fuser -fu... (4 Replies)
Discussion started by: Peuj
4 Replies

7. AIX

core file missing part of call stack

It seems that since the Upgrade from aix 4.3 to 5.2 the corefiles are somehow truncated. I tried the debuggers ddd, xldb and gdb everytime the same results. i found this on the IBM site: IBM Information center: If some entries appear in the Call Stack monitor but others are missing, this... (1 Reply)
Discussion started by: Lazzar
1 Replies

8. UNIX for Dummies Questions & Answers

/bin/sh: /usr/bin/vi: No such file or directory when doing crontab

I just set up an ftp server with Red Hat 5.2. I am doing the work, I'm baby stepping, but it seems like every step I get stuck. Currently, I'm trying to set up a crontab job, but I'm getting the following message: /bin/sh: /usr/bin/vi: No such file or directory. I see that vi exists in /bin/vi,... (3 Replies)
Discussion started by: kwalter
3 Replies
Login or Register to Ask a Question