I would like to seek some expertise of all our AIX experts on board.
1) I would like know how to get a return exit code of a command. I found that there are exist code for each and every command run in AIX but I just can't get the return code from my scripts.
A=`cp /home/abc/abc.txt /home/cde`
echo $A
If the return code exist, it should return to A and display on screen with the above scripts, but it doesnt. Anyone can help?
2) How to sucstract 2 months from current system month using AIX script?
date +"%h%Y" can show me Jun2007, I would like to get a Apr2007 result, how am I going to write the script?
Thank you suparnbector and kapilraj for your kindness help. I have solved my problem on the shell scripts.
But I have another question on the shell scripts as well.
3) How to check whether a particular file system have enough disk space for some process. I would like to write a script to check whether file system /abc has 5GB space for some other processes. Is there any commands that I can use directly to check or I need to write a script?
The normal approach is to use "df" and parse the results. Giving a path will just return you stats on that path, and the "-k" option gives you results in kilobytes rather than 512byte sectors.
I understand the usage of df -k. The script I am looking for is to capture the free space from df -k for particular file system and compare with the minimum space to return a result of whether it is "Adequate disk space" or "Lack of disk space"