#!/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