![]() |
|
|
|
|
|||||||
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help Required: Command to find IP address and command executed of a user | loggedout | Security | 1 | 06-05-2008 10:52 PM |
| how to? launch command with string of command line options | TinCanFury | Shell Programming and Scripting | 5 | 04-28-2008 03:06 PM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | Linux | 5 | 07-30-2007 05:26 AM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | HP-UX | 1 | 10-16-2006 01:16 PM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | Shell Programming and Scripting | 0 | 09-19-2006 06:44 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
AIX command help
I have this command in my script and it's working fine with AIX:
Code:
ls init?*.ora 2>/dev/null | egrep -i -e "" does anyone have better idea how to make it work for both ? Thanks Last edited by Yogesh Sawant; 05-01-2008 at 05:30 AM. Reason: added code tags |
| Forum Sponsor | ||
|
|
|
|||
|
What's the nature of the failure? What's the point of grepping for nothing (and really, what's the point of ignoring case in a string which doesn't have case!)? If you want to check if there was any output, even just an empty line, perhaps grep ^ would work on both platforms. But if ls works, the output should not have empty lines, so you could simply grep for a dot (meaning at least one character, any character).
(Just guessing that the problem is with egrep "" failing on Solaris. Perhaps you could check on that and report back.) |
|
|||
|
I would like to add to what era said that - AIX or not - this is the most awkward way to check for the existence of a file i have ever seen. Why not use something like:
Code:
if [ -f /your/file ] ; then
<whatever you want to do with the file here>
else
print -u2 "ERROR: file /your/file doe not exist!"
fi
"test -r" tests if it exists and is readable "test -w" tests if it exists and is writable etc., see to man page for "test" I hope this helps. bakunin |
|||
| Google UNIX.COM |
| Thread Tools | |
| Display Modes | |
|
|