I'm writing this simple script to cd to multiple folders from a file, but the cd doesn't work.
I have tried solutions in Why doesn't "cd" work in a bash shell script? and Shell script change directory with variable
But all didn't work.
Here is my script:
cat fileName.txt | while read line; do
echo $line
line=$(echo $line | tr -d '\r')
cd "$line"
done
+ inputFile=drugs800Folders.txt
+ IFS=
+ read -r line
+ line=CID000000923
+ cd CID000000923
+ awk '$11 < 0.05 {print $1 $2 $3 $8 $10 $12}' groups.txt
+ IFS=
+ read -r line
+ line=CID000001003
+ cd CID000001003
FilterFuncOutput.sh: line 5: cd: CID000001003: No such file or directory
+ exit
@Charles Duffy so it works, and did the awk for the first folder in the list, but not for remaining folders after the first line Does the first line only selects the first file in the list ?