![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help in substitution!!!! | uLearner | UNIX for Dummies Questions & Answers | 3 | 03-06-2008 07:21 PM |
| AWK substitution | klut | Shell Programming and Scripting | 4 | 01-15-2008 11:26 AM |
| ksh substitution | solea | Shell Programming and Scripting | 2 | 08-09-2004 06:30 AM |
| sed substitution | jo_aze | UNIX for Dummies Questions & Answers | 3 | 06-23-2002 10:32 PM |
| substitution | supercbw | Shell Programming and Scripting | 1 | 06-07-2002 04:07 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Need Help... I am getting a bad substitution error on my script on a Solaris Server. However the script has been proven to work on HPUX and Solaris servers...
#!/usr/bin/sh # # Set the location of the tzupdater.jar file # JAR=/tmp/tzupdater.jar # <<<<< UPDATE THIS LINE >>>>> # # Clear out log files if they exist if [[ -f /tmp/${0##*/}.all_javas ]]; then rm -f /tmp/${0##*/}.all_javas fi if [[ -f /tmp/${0##*/}.old_javas ]]; then rm -f /tmp/${0##*/}.old_javas fi if [[ -f /tmp/${0##*/}.cur_javas ]]; then rm -f /tmp/${0##*/}.cur_javas fi # Find all the files named java on the system # and save the list in a log of all java files find / -fstype nfs -prune -o -fstype autofs -prune -o -name java -type f -print -o -name java -type l -print | tee /tmp/${0##*/}.all_javas | \ while read JAVA; do exec 2>/dev/null # Ignore error messages $JAVA -version >/dev/null 2>/dev/null # Check how java responds if (( $? == 0 )); then # If RC=0, it is vaid # Find out the version of Java this is VERSION=$($JAVA -version 2>&1 | awk 'NR==1 {print substr($3,4,1)}') if (( $VERSION > 3 )); then # If the version is greater than 1.3, go ahead and update it print "$($JAVA -version 2>&1 | awk 'NR==1 {print $3}')\t$JAVA" >> /tmp/${0##*/}.cur_javas # Save list of current Javas # Check whether this java has been updated or not $JAVA -jar $JAR -t >/dev/null 2>&1 if (( $? > 0 )); then # If not updated, update it print "Updating $JAVA" $JAVA -jar $JAR -u else # Otherwise, print a message already updated print "$JAVA already updated" fi else # This cmd is an old version of Java print "$($JAVA -version 2>&1 | awk 'NR==1 {print $3}')\t$JAVA" >> /tmp/${0##*/}.old_javas # Save list of old Javas fi fi done # |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|