Sponsored Content
Top Forums UNIX for Dummies Questions & Answers return code capturing for all commands connected by "|" ... Post 302268163 by dr.house on Monday 15th of December 2008 06:01:08 AM
Old 12-15-2008
I'd "unpipe the piping", so to speak:

Code:
base=$( find someFile )
if [ $? -ne 0 ]
then
  echo "Error: $?"
  exit 1
else
  base=$( echo "$base" | xargs basename )
  if [ $? -ne 0 ]
  then
    echo "Error: $?"
    exit 1
  else
    echo "$base"
  fi
fi
exit 0

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Commands on Digital Unix equivalent to for "top" and "sar" on other Unix flavour

Hi, We have a DEC Alpha 4100 Server with OSF1 Digital Unix 4.0. Can any one tell me, if there are any commands on this Unix which are equivalent to "top" and "sar" on HP-UX or Sun Solaris ? I am particularly interested in knowing the CPU Load, what process is running on which CPU, etc. ... (1 Reply)
Discussion started by: sameerdes
1 Replies

2. Shell Programming and Scripting

Return code is "0" though the command fails.

The return code is "0" though the command fails. How to get a return code of "1" for this command when it fails or modify the command to get the right return code? On HP UNIX #-------- SCRIPT ---- #!/bin/ksh find /opt/oracle/oroem/product/10.2.0.4/rdbms/audit/ \( -name "*.aud" \) -mtime +1... (3 Replies)
Discussion started by: pbekal
3 Replies

3. UNIX for Dummies Questions & Answers

Command 'rm -f -r "0yfOYy-0008Nq-2j-32233-K"' failed with return code 1 and error mes

I would like to know what means this error and how to fix it Command 'rm -f -r "0yfOYy-0008Nq-2j-32233-K"' failed with return code 1 and error message Thank you (3 Replies)
Discussion started by: linuxbee
3 Replies

4. Shell Programming and Scripting

Unix commands delete all files starting with "X" except "X" itself. HELP!!!!?

im a new student in programming and im stuck on this question so please please HELP ME. thanks. the question is this: enter a command to delete all files that have filenames starting with labtest, except labtest itself (delete all files startign with 'labtest' followed by one or more... (2 Replies)
Discussion started by: soccerball
2 Replies

5. Shell Programming and Scripting

Number of times a user is "connected"?

hi i wish make a shell to look for the number of times a user is connected then makes a "whatch dog" by crontab to handle this i could do it through ps-fedal| grep user_name | wc-l ... etc. but others suggested me another algorithm :mad: and thought to use w, or finger, or who but it have a... (1 Reply)
Discussion started by: edgar287
1 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Solaris

Relation btw commands, "man" and "more" ???

Hi guys, Hope u r doing find. I have this query. When we check the manual pages for a certain command, say man cat we see the manual page with more What is UNIX really doing here, I mean why not less command instead of more command. And can we have UNIX display the manual pages with less command... (2 Replies)
Discussion started by: gabam
2 Replies

8. Red Hat

files having Script which works behind "who" & "w" commands

Dear All, plz print the path of files which have the script of "who" & "w" commands. thnx in advance. (6 Replies)
Discussion started by: saqlain.bashir
6 Replies

9. Solaris

How to execute a ".profile" depending on the server from where the user is connected.

Hello, I have two Solaris servers on a cluster. I have created the same user "X"on the two nodes (same UID and same GID). The file ".profile" of this user "X" is located in a filesystem that is seen by the two nodes. Each server should have a ".profile" of this user different of the other... (6 Replies)
Discussion started by: adilyos
6 Replies

10. UNIX for Beginners Questions & Answers

Extract delta records using with "comm" and "sort" commands combination

Hi All, I have 2 pipe delimited files viz., file_old and file_new. I'm trying to compare these 2 files, and extract all the different rows between them into a new_file. comm -3 < sort file_old < sort file_new > new_file I am getting the below error: -ksh: sort: cannot open But if I do... (7 Replies)
Discussion started by: njny
7 Replies
NFDUMP(8)						      System Manager's Manual							 NFDUMP(8)

NAME
nfdump, nfload - notesfile dump/load programs SYNOPSIS
nfdump notesfile nfload [ -Ddirectory ] notesfile DESCRIPTION
Nfdump and nfload are used to convert notesfile data base formats. Nfdump converts the specified notesfile to a portable ASCII format and writes it to standard output. Some diagnostics are produced on stderr. Nfdump can be run by any user; access to a particular notesfile is governed by that notesfile's access list. Nfload is used on the output from nfdump to create a new notesfile. The -D option specifies an alternate base directory for the notesfile. If unspecified, this defaults to ``/usr/spool/notes''. Nfload reads standard input for the ASCII representation of the notesfile. Typical use of these two programs occurs when converting an existing notesfile data base to a new format. The nfdump program should be compiled with the older structure definitions while nfload is compiled with the newer structures. The data base can then be converted with a shell script of the following nature: mkdir .OLD mv * .OLD for i in `ls .OLD` do echo $i start nfdump $i | nfload -D/usr/spool/newnotes $i done echo $i done echo ALL DONE rm -rf .OLD This assumes that the old data base is in ``/usr/spool/notes'' and the new data base is to be placed in ``/usr/spool/newnotes''. After the conversion is complete, one can move the old data base from ``/usr/spool/notes'' to ``/usr/spool/oldformat'' and the new data base from ``/usr/spool/newnotes'' to ``/usr/spool/notes''. FILES
SEE ALSO
notes(1), The Notesfile Reference Manual AUTHORS
Ray Essick (uiucdcs!essick, essick%uiuc@csnet-relay.arpa) Department of Computer Science University of Illinois at Urbana-Champaign Urbana, IL Rob Kolstad (kolstad@convex.UUCP) CONVEX Computer Corporation Richardson, TX University of Illinois NFDUMP(8)
All times are GMT -4. The time now is 03:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy