I wrote this dead simple code to reproduce a directory hierarchy:
for dir in $(find @args[1] -type d)
mkdir -v $( echo $dir | sed "s/@args[1]/@args[2]/" )
end
With mkdir -p src/a src/b
I create the following structure:
src/
|-- a
`-- b
I then call my script like so:
./copy_tree.ion src out
This gives me the following error:
mkdir: out
out/b
out: No such file or directory
This equivalent script works in bash and ksh:
for dir in $(find $1 -type d)
do
mkdir -v $( echo $dir | sed "s/$1/$2/" )
done
I can’t imagine where there could be a mistake. If I replace mkdir -v
with another echo
in the Ion version, it outputs the correct strings that mkdir
needs, yet for some reason when I run the script it doesn’t work.