I need to set an environment variable for a command that is being called via nice. [Bash and dash, Slackware and FreeBSD.]
$ JIM=20 nice -n 10 echo $JIM
$
Nope, echo can't see JIM
$ nice -n 10 JIM=20 echo $JIM
nice: JIM=20: No such file or directory
$
nice don't like it.
I can export JIM and then echo can see it, but now I'm polluting the environment. Unclean!
I tried the "--" option to signify end of command line variables for nice, but it makes no difference, nice complains. I can't believe no one has wanted to do this before, so I'm probably making a very basic error.
Any ideas?