AIX command help


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users AIX command help
# 1  
Old 04-30-2008
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 ""

the same command is failing in Solaris 10.

does anyone have better idea how to make it work for both ?

Thanks

Last edited by Yogesh Sawant; 05-01-2008 at 09:30 AM.. Reason: added code tags
# 2  
Old 05-01-2008
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.)
# 3  
Old 05-01-2008
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 -f" tests if the the file exists and is a regular file (not a directory, device file, etc.)

"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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Maxdepth command not working in AIX.Need alternative solution for this command

Hi All, I am trying to select 30 days older files under current directory ,but not from subdirectory using below command. find <Dir> -type f -mtime + 30 This command selecting all the files from current directory and also from sub directory . I read some documention through internet ,... (1 Reply)
Discussion started by: kommineni
1 Replies

2. AIX

I need help on AIX command

I'm new for aix...I need a command or script to check the high usage of cpu process and the physical cpu utilization... TIA Sumanth (9 Replies)
Discussion started by: sumanthupar
9 Replies

3. AIX

at command in aix

Hi I use this "at" command to unmount 12 filesystems in my aix server echo "ksh /usr/local/bin/umount.sh" | at now i want to schedule it on a daily basis. I know that it can be done via crontab. But Im just curious to know if daily wise scheduling can also be done via the "at" command ?... (1 Reply)
Discussion started by: samsungsamsung
1 Replies

4. AIX

help ma aix command

I don't know to aix command to check number of cpu, speed of cpu memory, size, memory type (ex. memory type chipkill) internal harddisk, size how many to seial I/O ? fibre network interface raid controller, raid type DVD-rom, speed DVD-rom aix version... (1 Reply)
Discussion started by: lovenid
1 Replies

5. AIX

Need AIX command

1.What is the equivalent of the command "ls -ltr -h" in AIX..Which will list all file name with their size in GB 2. What comand can be used to display the output of df -k in GB in AIX. In in solaris we do df -h. Thanks in advance (6 Replies)
Discussion started by: e263041
6 Replies

6. UNIX for Dummies Questions & Answers

Need AIX command

1.What is the equivalent of the command "ls -ltr -h" in AIX..Which will list all file name with their size in GB 2. What comand can be used to display the output of df -k in GB in AIX. In in solaris we do df -h. Thanks in advance (0 Replies)
Discussion started by: e263041
0 Replies

7. AIX

AIX - 'at' command

I am working on AIX 5.2 platform and working with AIX command 'at' . May I am getting a weird problem . I have a script which is scheduled to run everyday.It uses 'at' command to call one java program. Most of the times 'at' command works fine without any issue but sometimes 'at' command... (10 Replies)
Discussion started by: techi_0408
10 Replies

8. AIX

Which command in AIX 5L is replace updatelv in AIX 4.3?

When I import VG, it shows: 0516-622 synclvodm: Warning, cannot write lv control block data. I found AIX V4.3 have updatelv command can recovery LVB from VG, however, updatelv is not existed on AIX 5L, which command to replace it? (2 Replies)
Discussion started by: rainbow_bean
2 Replies

9. AIX

AIX:Command to get netaddress/subnet address command in IPv4/IP6

AIX:Command to get netaddress/subnet address command in IPv4/IP6 Can anybody help us with a command to retrieve netaddress/subnet address command in IPv4/IP6 on aix machine. net/subnet address is in the format 172.16.212.0(signifies all 255 machines in an IPv4 network) (2 Replies)
Discussion started by: rookie8278
2 Replies

10. Programming

command for hp-ux and aix

is there is any command for obtaining System manfuture detail lke Dell, IBM etc from HP-UX and AIX command. (0 Replies)
Discussion started by: janki0111
0 Replies
Login or Register to Ask a Question