3 ms·
shell? Something like this (definitely buggy; you’ll have to remove the ‘$’ from the line before you evaluate it. I also didn’t check how to match that dollar s
by Someone 7y ago
shell? Something like this (definitely buggy; you’ll have to remove the ‘$’ from the line before you evaluate it. I also didn’t check how to match that dollar sign at the start of a line. I think you can solve both problems by using a semicolon, not a dollar sign as indicator for ‘evaluate this line’. You also _may_ want to allow multi-line commands and there maybe more bugs):
while read line ; do
case "$line" in
\$*) `$line`
*) echo $line
;;
esac
done