I already searched stack overflow, but there was nothing suitable for my problem.
What I wanted to do:
I have a directory:
In this directory is my script firstScript.sh. I want it to do 3 things:
- get into directory: ~/mytest
- take every file in there
- and use a command on it (for example cat)
To realize the first Step I found this question
and tried this (used ls -l as command to see if the right directory was found):
#step 1 get into the directory
#setp 2 loop through all files
#step 3 add the command
cd /mytest ls -l
# cd ~/mytest ls -l
nothing happened, so I tried the path and command by myself in the console/terminal and it is the correct path for sure. Any Idea what is wrong with this? Also tried this with ./relativ/path, but this didnt work as well.