Sponsored Content
Top Forums Shell Programming and Scripting Ignore exit status for #!/bin/bash -e Post 302987595 by rbatte1 on Tuesday 13th of December 2016 07:32:43 AM
Old 12-13-2016
I'm a little confused on the requirement:-
  1. Would you worry if a file or directory of that name already existed?
  2. Are you just trying to create symbolic links if the symbolic link does not exist?
Have a look at the options for flags for the test man test You can see that -e is just for "exists" but you can tailor it to look for directories, plain files, symbolic links, pipes, empty files etc. to suit your needs.


Does that help to tie down the possible conditions you need to handle?




Robin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

exit status

i downloaded a text file from metalab.unc.edu called sh.txt and in this reference manual it refers to shell scripting exit status .. at the end of one of the examples that author gave an exit status of 127.. to what does a 127 exit status refer too and what is its purpose in the code. moxxx68 (1 Reply)
Discussion started by: moxxx68
1 Replies

2. Shell Programming and Scripting

How to get exit status codes in bash from Perl?

I apologize if I have already posted this query. I scanned back quite a few pages but could not find such a query. If my perl code contains "exit(33)" how can I get that value in bash for use in a "if" statement. Thanks, Siegfried (5 Replies)
Discussion started by: siegfried
5 Replies

3. Shell Programming and Scripting

exit status for isql

I'm trying to write a script that will update a table in sysbase. If it's failed then I want to rerun it one more time before exiting the script (fail due to bad value such as trying to put a string into datetime field or bad connection to the database) Well my code below will always return... (2 Replies)
Discussion started by: sirrtuan
2 Replies

4. Shell Programming and Scripting

How to get the exit status

Hi all, I'm running a program which return 1 upon success. But when encounters problem shell return 's '1' . How to differentiate between them the shell return value and script return value. Ex. function fn return '1' if executed successfully and '0' if failed. But when if shell encounters... (1 Reply)
Discussion started by: yhacks
1 Replies

5. Shell Programming and Scripting

Exit status

I'm preparing for exam and one of exams is to write own test command... I wonder if in unix is a command which just returns exit code you specify.. I know I can easily write a function like this: exStatus() { return $1 } -> my question is rather theoretical thank you! (9 Replies)
Discussion started by: MartyIX
9 Replies

6. Shell Programming and Scripting

Exit status redirection

Hi, I'm having this simple code below, the file serverlist has a list of IPs one per line. When executed the while loop is executed only once, after that the program terminates. How should i redirect the exit status, so that the entire list of IP will get executed? #!/bin/bash exec <... (4 Replies)
Discussion started by: agent001
4 Replies

7. Shell Programming and Scripting

Exit Status

I have a shell script (#!/bin/sh) that interacts with Appworx and Banner Admin. In my script I want to check the exit status of awrun before continuing. awrun can run for 10 seconds or it can run for over a minute. So my question is, will it go through my if statement before awrun may even be... (2 Replies)
Discussion started by: smkremer
2 Replies

8. Shell Programming and Scripting

Want to get the exit status

Hi All, I am trying to create a zip file with all the txt files(these are in large number) in the current directory. I am able to do this operation sucessfully. After this i want to get the status of the tar command executed and do accordingly. When i am trying with the below code, the status... (3 Replies)
Discussion started by: paddu
3 Replies

9. 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

10. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

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)
Discussion started by: i4ismail
3 Replies
LNDIR(1)						      General Commands Manual							  LNDIR(1)

NAME
lndir - create a shadow directory of symbolic links to another directory tree SYNOPSIS
lndir [ options ] fromdir [ todir ] DESCRIPTION
The lndir program makes a shadow copy todir of a directory tree fromdir, except that the shadow is not populated with real files but instead with symbolic links pointing at the real files in the fromdir directory tree. This is usually useful for maintaining source code for different machine architectures. You create a shadow directory containing links to the real source, which you will have usually mounted from a remote machine. You can build in the shadow tree, and the object files will be in the shadow directory, while the source files in the shadow directory are just symlinks to the real files. This scheme has the advantage that if you update the source, you need not propagate the change to the other architectures by hand, since all source in all shadow directories are symlinks to the real thing: just cd to the shadow directory and recompile away. The todir argument is optional and defaults to the current directory. The fromdir argument may be relative (e.g., ../src) and is relative to todir (not the current directory). If you add files, simply run lndir again. New files will be silently added. Old files will be checked that they have the correct link. Deleting files is a more painful problem; the symlinks will just point into never-never land. OPTIONS
-silent Normally lndir outputs the name of each subdirectory as it descends into it. The -silent option suppresses these status messages. -silent may be abbreviated to -s. -ignorelinks If a file in fromdir is a symbolic link, lndir will make the same link in todir rather than making a link back to the (symbolic link) entry in fromdir. The -ignorelinks option changes this behavior. The link created in todir will point back to the corre- sponding (symbolic link) file in fromdir. If the link is to a directory, this is almost certainly the wrong thing. The -ignore- links option may be abbreviated to -i. -withsymdirs If a file in fromdir is a symbolic link to a directory and the -withsymdirs option is specified, lndir will shadow the directory tree the symbolic link points to, whether or not the -ignorelinks is also specified. The -withsymdirs option may be abbreviated to -d. -clean lndir will remove dangling symbolic links and empty directories in the shadow tree. The -clean option may be abbreviated to -c. -cleanonly lndir will do the cleaning phase only, not creating the shadow tree. The todir argument may be provided, and defaults to the cur- rent directory when not provided. -withrevinfo lndir will normally not shadow any BitKeeper, RCS, SCCS, CVS, CVS.adm and .svn subdirectories, nor any .cvsignore and .gitignore files. This option causes these directories and files to be treated as any other, rather than ignored. -withrevinfo may be short- ened to -r. -noexceptions By default, lndir does not shadow files or directories whose name is .DS_Store, or ._.DS_Store, or starts with '.#', or ends in '~'. This option, which may be abbreviated to -E, causes such files to also be shadowed. -except This option adds name to an initially empty list of filenames in fromdir that are not to be shadowed. -except may be specified as -e. This option may be repeated as many times as necessary. DIAGNOSTICS
The program displays the name of each subdirectory it enters, followed by a colon. The -silent option suppresses these messages. A warning message is displayed if the symbolic link cannot be created. The usual problem is that a regular file of the same name already exists. If the link already exists but doesn't point to the correct file, the program prints the link name and the location to which it does point. XFree86 Version 4.7.0 LNDIR(1)
All times are GMT -4. The time now is 11:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy