I want to create files and the names of these files should be like the names of directories in the /
directory
I created a shell script like this :
#!/bin/bash
cd /
declare -a array=($(ls -d */));
For i in "${array[@]}"; do
touch $i
done
But it doesn't do anything when I execute it!
Although when I replace the touch
with echo
, it does print the directories names into the screen.
So I think the problem is with the touch
command?
Or if there is another way of doing this instead of shell script?