I am writing a bash script , I used 1 variable in my bash file like below
list=`/home/ea/students'
I wrote below link in my bash but I got error
cat $list /admin.txt
Do you know how can I connect variable and string together?
I am writing a bash script , I used 1 variable in my bash file like below
list=`/home/ea/students'
I wrote below link in my bash but I got error
cat $list /admin.txt
Do you know how can I connect variable and string together?
You can go with either:
cat "$list/admin.txt"
In this case the braces '{}' are not mandatory as the / is not a valid identifier name character.
... or, if you need a variable, recent bash versions provide more concise way for appending:
bash-4.1$ list=/home/ea/students
bash-4.1$ list+=/admin.txt
bash-4.1$ printf '%s\n' "$list"
/home/ea/students/admin.txt