Hi All,
I am trying to get latest folders based on some condition. The below sample script working fine for me.
#!/bin/sh
INSTALLDIR=`pwd`
_UPGRADE_=1
CMD="ls -rtp $INSTALLDIR | grep /"
CMD1="ls -rtp $INSTALLDIR | grep / | grep -v '^server/$'"
Get_my_dir(){
for SDIR in $(ls -rtp $INSTALLDIR | grep /) ; do
echo source dir : $SDIR
done
}
Get_my_dir
But when i modified the line
for SDIR in $(ls -rtp $INSTALLDIR | grep /) ; do
to
for SDIR in $( $CMD) ; do
This gives error. I want prepare my command and store into $CMD variable based on the boolean variable for _UPGRADE_.
Please let me know, how to run the $CMD insist of the hard coded things.
Thanks in advance.