Reputation: 103
For some reason, resolving a variable name within backticks and double quotes causes an empty new line.
search="randomsite";
res="`find /var/www -maxdepth 2 -mindepth 2 -type d -name '${search}'`";
echo $res
Upvotes: 0
Views: 54
Reputation: 207560
Use $()
rather than backticks - they are easier to read and nestable...
res=$(find /var/www -maxdepth 2 -mindepth 2 -type d -name "${search}")
Upvotes: 2