I need to copy the content of the parent directory to the newly created sub-directory.
Initially, the structure is like this:
Parent
abc.txt
work_dir/
script.sh
Expected Output:
Parent
abc.txt
work_dir/
script.sh
sub_dir/
abc.txt
work_dir/
script.sh
Now I am in the work_dir, and I am executing script.sh
. The content of this file is below:
/bin/sh
mkdir ../sub_dir
shopt -s extglob
cp -r ../!(sub_dir) ../sub_dir/
I get the following error: syntax error near unexpected token `('. Error: exit status 2
If I change it to this cp -r '../!(sub_dir)' ../sub_dir/
, I get cp: ../!(sub_dir): No such file or directory
Any help is appreciated, Thanks