Thank you for your hard work.
Let's say the following code is the main subject.
#!/bin/bash
file_name = test.txt
while read line;do
dir = ${line}
while read;do
echo "Verify operation: ${red}"
done<<(find${dir}-type f)
done<${file_name}
Doing so will result in the error Find: 'Directory Name': No such file or directory.
How do I resolve this?
Supplemental:
The test.txt contains the directory path.
I would like to specify it as the path to find and search for files below that directory.
#!/bin/bash
dir = "Directory Path"
while read;do
echo "Verify operation: ${red}"
done<<(find${dir}-type f)
If you write like above, it will work.
When I see the error message, it seems that something is stuck together, but I don't know how to deal with it.
Thank you for your cooperation.
bash shellscript
find
(1) displays such a warning that the path to be scanned does not exist. All you have to do is check if it exists before passing it to find
.
#!/bin/bash
exec<dir.txt
while IFS = read-rd; do
[[-d$d]]|| continue
find "$d" - type f-exec sh-c' for file in "$@"; do echo "Verify operation:$f"; done'sh{}+
done
Try connecting the find
command to `
instead of ()
.
Excerpt only the relevant parts…
while read;do
echo "Verify operation: ${red}"
done<`find${dir}-type f`
Run Environment
bash 3.2
RHEL 5.11
© 2024 OneMinuteCode. All rights reserved.