I do this in a script:
read direc <<< $(basename `pwd`)
and I get:
Syntax error: redirection unexpected
Before running the script, you should check first line of the shell script for the interpreter.
Eg: if scripts starts with /bin/bash , run the script using the below command "bash script_name.sh"
if script starts with /bin/sh, run the script using the below command "sh script_name.sh"
./sample.sh - This will detect the interpreter from the first line of the script and run.
Different Linux distributions having different shells as default.