[SOLVED] Problems with "exit" called from function in bourne script
Hi everyone.
This is my stripped script for android environment and is launched in the recovery mode. No bash or ksh, must be /sbin/sh provided and symlinked by busybox toolbox.
When function is called, the commands "exit", "exit 0" and "exit 1" only exit from function and always show "EXIT" and "OK", but not end the script as I would like. Whats wrong?
I need call EXITING many times in the script and need the "exit" command working, is there an alternative to force exit?
thank in advance and sorry for my english.
Last edited by vacadepollo; 05-02-2012 at 10:59 AM..
I'm using busybox "BusyBox v1.19.4-cm9 bionic" included in the cyanogenmod 9 kernel.
I'm pretty sure that in others kernels/busybox this code is working flawless but I need to find an universal method that provide an exit in whatever busybox version.
No... Seems like behavior of break. Are you sure /sbin/sh is busybox's? Seems like an odd place. Thought Android put it in /system/xbin or something. It may have -x option to trace. if you run sh -x script you should see nothing after + exit ...
No... Seems like behavior of break. Are you sure /sbin/sh is busybox's? Seems like an odd place. Thought Android put it in /system/xbin or something. It may have -x option to trace. if you run sh -x script you should see nothing after + exit ...
mmmm I know, but it happens.
OK, my fault, sorry, EXITING is called from other function, this is the problem.
the "for" loop call "CHECKING" and then call "EXITING" , but only break the "for" loop, and get the same behavior, show me "OK" echo.
(*this is a sample to show the concept)
test.sh
sh -x test.sh
I use "#!/sbin/sh" because my script in some point makes a /system format and need the busybox integrated in the recovery, not the included in /system. And /sbin/sh is the standard path to launch the shell from recovery.
Last edited by vacadepollo; 05-02-2012 at 10:27 AM..
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
I am trying to allow the user to be notified that the id has already taken from the file "record" and that the user has to contain a numerical figure as well. however when i run it, it will only stay at the please enter a number section and does not change. do u know where is the problem?
... (2 Replies)
So, I have an expect script (let's call it expect.exp) that takes 3 arguments. It logs into a remote server, runs a set of commands, then hands control over to the user by the "interact" command. If I call this script from the command line, it works properly.
Now I'd like to apply this script... (2 Replies)
Hi,
Using AIX 5.3 and Ksh.
/>ls -al /usr/bin/ksh
-r-xr-xr-x 5 bin bin 237420 Apr 10 2007 /usr/bin/ksh
/>
I recently started working for a new employer. I have written UNIX K-Shell scripts for many years and have never had this particular issue before. Its perplexing me.
I have... (2 Replies)
Hallo,
i need a Prompting read in my script:
read -p "Enter your command: " command
But i always get this Error:
-p: is not an identifier
When I run these in c-shell i get this error
/usr/bin/read: read: bad option(s)
How can I use a Prompt in the read command? (9 Replies)
Hi,
I was trying to call "script <an ip add>" command from .profile file to log everything whenever anyone logs in to this user. I did the following at the end of .profile. 1) Extracted the IP address who logged in 2) Called script < ip add> . The problem I am facing is all, aliases etc. written... (3 Replies)