Reputation: 2881
The following works on console, but throws an "invalid option" when run as part of a bash script.
styles=find . -type d -maxdepth 1 | awk -F/ {'print $NF'}
line x: .: -t: invalid option
Upvotes: 0
Views: 5218
Reputation: 41987
To save the output of a command to a variable, you need to use command substitution:
styles="$(find . -maxdepth 1 -type d | awk -F/ '{print $NF}')"
Upvotes: 2