I want to include * as mentioned below in double inverted commas, but i am not able to find the file. When i remove the inverted double inverted commas it works.
$CONTROL=/bkp/Test/back/13_Mar_2018/
ls -lrt "$CONTROL\*controlfile";
I want to include * as mentioned below in double inverted commas, but i am not able to find the file. When i remove the inverted double inverted commas it works.
$CONTROL=/bkp/Test/back/13_Mar_2018/
ls -lrt "$CONTROL\*controlfile";
Pathname expansion doesn't work within quotes. However, you can do something like this:
CONTROL=/bkp/Test/back/13_Mar_2018/
ls -lrt "$CONTROL"*controlfile
$CONTROL
is quoted to prevent side effects like field splitting.*
is not quoted to allow pathname expansion.controlfile
doesn't need to be quoted, but you can quote it if you want.*
was not the part we should focus on.
– nxnev
Mar 15 '18 at 06:08
ls
.
– Kusalananda
Mar 15 '18 at 06:38