I am in /home/aaa path and trying to list all the files in different directory - the path to this directory is lengthy. For example: aa/bb/cc/dd/ee/ff/gg/hh/ii/jj... and also the path will change dynamically.
HEnce I capture the directory path in a variable. How to use this variable in ls command.
The variable is $dir_name
I currently have ls $dir_name out_* | wc -l
To list all files starting with "out_" from directory in variable "$dir_name".
I will enter the directory path and capture it in a variable. When I execute this command, i get the message " ls $dir_name out_* | wc -l" command not found.
But the directory path that I want to list is in the root.
I am currently in /home/aaa
the files that want to list is in /aa/bb/cc/dd/ee/ff/gg....
any help?
Thanks!