Reputation:
I'm sorry for likely trivial question but i start learning Bash two days ago. I'm still newbie :).
if [ ! -d $backup_directory ]; then
echo $'Backup device is not mounted or is mounted somewhere elese\a!'
echo "Press enter when sdc device mounted to /mnt/sdc1 or past alternative path:"
while [ ! -e $backup_directory ]; do
alter_dev_path=""
read $alter_dev_path
if [ "$alter_dev_path" != "" ]; then
$backup_directory=$alter_dev_path
$destination_directory=$alter_dev_path+"/sh-backup"
$result_path=$destination_directory+"/programming-base"
fi
done
fi
Thats is if statement from my backup script. I want program to ask me about device mount directory. But while loop is just omitting if statement inside with no effect. Thanks, Siery.
Upvotes: 1
Views: 77
Reputation: 123410
To read a value:
read $alter_dev_path # Wrong
read alter_dev_path # Correct
To assign a value:
$destination_directory=$alter_dev_path+"/sh-backup" # Wrong
destination_directory="$alter_dev_path/sh-backup" # Correct
Upvotes: 2