function nvis()
{
while true; do
nvidia-smi
sleep $1
done
}
I'm trying to use it like:
nvis 2
and I get an error like:
bash: syntax error near unexpected token `2'
Sorry if this is obvious; I am kind of stumped.
function nvis()
{
while true; do
nvidia-smi
sleep $1
done
}
I'm trying to use it like:
nvis 2
and I get an error like:
bash: syntax error near unexpected token `2'
Sorry if this is obvious; I am kind of stumped.
With your information, the error is not reproducible. This works fine:
#!/bin/bash
function nvis()
{
while true; do
echo nvidia-smi
sleep $1
done
}
nvis 2
I also tried your code - works fine. I will guess that your file contains 'hidden' control codes. Try:
cat -v yourfile # OR
cat -vE yourfile
See any special codes? - remove them
Also, try:
bash -nv yourfile
:)