Results 1 to 3 of 3
#!/bin/sh
echo -n "enter path of directory > ";
read DIRECTORY
echo -n "enter name and path of file 1 > ";
read FILE1
echo -n "enter name and path ...
- 11-26-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 2
[SOLVED] why?????
#!/bin/sh
echo -n "enter path of directory > ";
read DIRECTORY
echo -n "enter name and path of file 1 > ";
read FILE1
echo -n "enter name and path of file 2 > ";
read FILE2
if [ "$DIRECTORY" -a "$FILE1" -a "$FILE2"]
then
echo "all paths have been entered"
else
echo "not all paths have been entered"
fi
if [ -d $DIRECTORY]
then
echo "$DIRECTORY ok"
else
echo "$DIRECTORY not ok"
fi
if [ -f $FILE1]
then
echo "$FILE1 ok"
else
echo "$FILE1 not ok"
fi
if [ -f $FILE2]
then
echo "$FILE2 ok"
else
echo "$FILE2 not ok"
fi
why doesn't this work?!?!?
i'm using bourne shell and just want the user to enter and directory and two paths and the script to say whether they exist or not. thanks in advanced!
- 11-26-2008 #2
Welcome to the forums!
Your script will fail at several points actually. All have to do with syntax. You seem to be missing a lot of (mandatory) white spaces between your variables and the closing ']'.
For example:
You wrote: if [ -d $DIRECTORY]
Should be: if [ -d $DIRECTORY ]Can't tell an OS by it's GUI
- 11-26-2008 #3Just Joined!
- Join Date
- Nov 2008
- Posts
- 2
Thanks! it working now..


