... ... ...
Btw. "exit" by default means "exit 0", so you don't have to write that. But you should make your exit codes to be meaningful and documented, for instance:
0: success (always! - that is standard)
1: file not found
2: no space left on device
3: ....
... ... ...
bakunin
Actually, in any POSIX/UNIX conforming shell,
is not the always the same as
When exit is called with no operands, the rules are:
Quote:
The value shall be the exit value of the last command executed,
or zero if no command was executed. When exit is executed in a
trap action, the last command is considered to be the command
that executed immediately preceding the trap action.
Thus, if the success or failure of a shell script is determined by the last command the script executes, calling exit without an exit status returns the exit status of that command. So, the code sequences:
in a script all provide the same exit status to the invoking shell.
---
This has been edited, I originally screwed up the test for success.
Last edited by Don Cragun; 08-04-2012 at 02:23 PM..
Hi,
My ubuntu flavor always create temporary files having filename followed by ~ on editing. For eg: if I am editing a file called "sip.c", automatically a temporary (bkup) file is getting created with the name "sip.c~". How to avoid this file creation? (7 Replies)
Hello everyone,
I am creating a temporary file in my ksh by using something file
filetemp=filetemp.$$
Later on in my script I write to the file $filetemp by 'cat'ing to it.
Then in the script I am doing a 'less' on the file to view it.
At the end of the script I issue a rm $filetemp 2>... (4 Replies)
Hey Guys,
I was wondering if someone would give me a hand with an issue I'm having, let me explain the situation:
I have a file that is constantly being written to and read from with updated lines:
# cat activity.file
activity1
activity2
activity3
activity4
activity5
This file... (2 Replies)
Dear other forum members,
I'm writing a script for my homework, but I'm scratching all over my head and still can't figure out what I did wrong. Please help me. I just started to learn about bash scripting, and I appreciate if anyone of you can point out my errors. I thank you in advance.
... (3 Replies)
Hi,
I am looking to use rsync in a very specific way, and even though I have trawled the rsync man pages I have not succeeded in seeing a way of doing the following:
The temporary files created by rsync should not be created in the destination directory. (I have used --temp-dir option to... (0 Replies)
I want to create a folder for users to put their temporary files and a folder for users to put their permanent files. For the temporary folder, I need to implement a deletion policy. I would like to know normally which time, ctime, mtime or atime, should be used to implement such deletion policy. (1 Reply)
Hi,
Some porocess is creating hidden temporary files in /tmp directory. And they are not getting deleted. System is going out of disk space after some days.
The temp files are getting created like .<user name><pid>. I have checked the application code, but didnt get any clue. Does these files... (4 Replies)