2 ms·
While I applaud the effort and extensive documentation I'd never use something like this in production. For example have a look at the definition of `sfor`
by oweiler 9y ago
While I applaud the effort and extensive documentation I'd never use something like this in production.
For example have a look at the definition of `sfor`
sfor 'i=1' '[ "$i" -le 10 ]' 'i=$((i+1))'; do
print "$i"
done
Doesn't look too bad at first, until you realize `sfor` is an alias which is defined as
alias sfor='_Msh_sfor_init=y && while _Msh_doSfor'
So it's an alias which expands to two commands.
No have a look at the definition of `_Msh_doSfor`
_Msh_doSfor() {
case ${#},${_Msh_sfor_init+y} in
( 3, ) eval " $3" || die 'sfor: loop command failed' || return ;;
( 3,y ) eval " $1" || die 'sfor: init command failed' || return
unset -v _Msh_sfor_init ;;
( * ) die "sfor: 3 arguments expected, got $#" || return ;;
esac
eval " $2" || case $? in
( 1 ) return 1 ;;
( * ) die "sfor: test command failed" ;;
esac
}
No thanks, I'd rather use Python.
- yorwba 9y agoI think the point of this library is that all those gory details necessary for sane error handling are encapsulated, so you can build on that work if you absolutely need to write shell scripts. Otherwise, yeah, I hope that Oil will be the promised better shell and make bash & co. obsolete.