![]() |
|
|
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 |
| Defining EDITOR Variable - Tru64 | Bagel08 | UNIX for Dummies Questions & Answers | 2 | 12-15-2008 12:05 PM |
| defining a printer in qconfig | matheeq | AIX | 0 | 03-18-2008 11:55 AM |
| Defining Variables | sailorliones | UNIX for Dummies Questions & Answers | 4 | 07-21-2006 04:09 PM |
| defining a variable as a number or character? | noobian | UNIX for Dummies Questions & Answers | 1 | 04-26-2005 09:19 PM |
| Defining variables at boot time | ianf | UNIX for Dummies Questions & Answers | 7 | 01-07-2002 01:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Is the start of the script trying to rename both the files named in shell variables ${DMI_FILE} and ${SNMP_FILE} , rather than a file called "conf" in the current working directory ?
If so, then please try the construct below (untested) and remove the "echo" from the "mv" line if it does what you want. I've avoided having a shell variable called "conf" because it appears to be causing confusion! Where you had a shell variable called "conf" I have called it "filename". We are back to "bash" because I don't think that "test -e" is valid in ksh. Code:
#!/usr/bin/bash
# My Variables
DMI_FILE="/etc/dmi/conf"
SNMP_FILE="/etc/snmp/conf"
for filename in "${DMI_FILE}" "${SNMP_FILE}"
do
if [ -e "${filename}" ]
then
echo mv "${filename}" "${filename}.orig"
echo "${filename} has been moved"
else
echo "${filename} does not exist"
exit
fi
done
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|