#!/bin/bash
#trash.sh
$TRASHDIR=$HOME/trash
#Does not exist yet, i have loops further in
#the script to check if the dir exists and to create it if not
echo $TRASHDIR
#I have ommited the rest of the script,
#because this is where I have the problem
これを実行してみましょう:
./trash.sh
./trash.sh: line 3: =/home/someuser/trash: No such file or directory
このファイル名をbashで評価せずに変数に保存するにはどうすればよいですか?また、後でこの変数をテストに使用するにはどうすればよいですか?
if [ -e $TRASHDIR ]
then
echo stuff here
fi