'Bash script error "No such file or directory"
Hello im making a simple script, but i need to create a folder work on that folder. For example. Im in FolderNew, and i want to Create FolderA and inside that save a file return from that folder and Create FolderB and inside save a file.
---FolderNew
--FolderA -FileA
--FolderB -FileB
Here a dummy of the code
mkdir FolderNEW && cd FolderNEW && mkdir FolderA
cd FolderA
echo "test" > A.txt
echo "test" > B.txt
echo "test" > C.txt
mkdir Checker && cd Checker
cat Filesnew.txt | while IFS= read -r line;
do
echo "Process"
done
cd ../
But when i execute the code i get an error with "1.sh: line X: cd: Checker: No such file or directory. But the folder exist if a add a ls command.
Any advice
Solution 1:[1]
Try running the code again but this time create the "Filesnew.txt" file first
mkdir FolderNEW && cd FolderNEW && mkdir FolderA
cd FolderA
echo "test" > A.txt
echo "test" > B.txt
echo "test" > C.txt
mkdir Checker && cd Checker
echo "test" > Filesnew.txt
cat Filesnew.txt | while IFS= read -r line;
do
echo "Process"
done
cd ../
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kuroneko |
