I wrote this dead simple code to reproduce a directory hierarchy:
for dir in $(find @args -type d)
mkdir -v $( echo $dir | sed "s/@args/@args/" )
With mkdir -p src/a src/b I create the following structure:
I then call my script like so:
./copy_tree.ion src out
This gives me the following error:
out: No such file or directory
This equivalent script works in bash and ksh:
for dir in $(find $1 -type d)
mkdir -v $( echo $dir | sed "s/$1/$2/" )
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.
Thank you for sharing code examples here, it is something I would like to see more of. I am a beginner but hope that seeing snippets of script and code in the conversations will have an effect like that claimed for learning a foreign language - being immersed will allow some of the knowledge to creep in eventually!
Hopefully it is of more immediate use to others too!
You’re right, although my only interest in languages at the moment is in using C to write keyboard stuff in QMK Firmware, and I don’t think I will be contributing operating system stuff in Rust anytime soon. Hopefully my postings here serve as a demonstration to lurkers that it is not necessary to be some sort of coding guru to join the community and contribute to the discussion!
Oh, well if you become interested in learning Ion I’d be happy to help. I’m almost done studying the manual and I think answering questions would be a great way to test what I’ve learned. It’s a pretty small language and there’s no complicated, low-level, operating system stuff, so it’s pretty easy too.