https://git.sr.ht/~sircmpwn/rc
https://drewdevault.com/2023/07/31/The-rc-shell-and-whitespace.html
loop over files
Unlike with posix shell, whitespace is handled correctly:
for (i in *.jpg) {
cp $i subdir
}
change file extension
fn suf(fname) {
echo $fname | sed -e 's/\..*//'
}
for (i in *.jpeg) {
mv $i `{suf $i}.jpg
}
path for most recent download
#!/bin/rc
cd $HOME/tmp
echo $HOME/tmp/`{ls -t | head -n1}
recent files
fn recent {
shift
ls -ltch $*
}