Skip to main content
added 5 characters in body
Source Link
SYN
  • 2.9k
  • 14
  • 19

In shell, setting variables would be done with:

var1=toto
var2="$(echo toto | othercommand)"

You can't have spaces between your variable name, the equal character and the value you're assigning your variable with.

Then, to echo a variable, you would do:

echo $var
echo "$var"
echo "${var}"

The & character, in bash/sh, is used for "job control", which is yet another topic, ...

Start by using the following instead, tell us how it goes:

#! /bin/sh

while true;do
    var="$(echo "RDTEMP1" | netcat -q2 sanderpi 5033)"
    echo "$var"
    echo "$(date +%Y-%m-%d%t%H:%M:%S)"
done

In shell, setting variables would be done with:

var1=toto
var2="$(echo toto | othercommand)"

You can't have spaces between your variable name, the equal character and the value you're assigning your variable.

Then, to echo a variable, you would do:

echo $var
echo "$var"
echo "${var}"

The & character, in bash/sh, is used for "job control", which is yet another topic, ...

Start by using the following instead, tell us how it goes:

#! /bin/sh

while true;do
    var="$(echo "RDTEMP1" | netcat -q2 sanderpi 5033)"
    echo "$var"
    echo "$(date +%Y-%m-%d%t%H:%M:%S)"
done

In shell, setting variables would be done with:

var1=toto
var2="$(echo toto | othercommand)"

You can't have spaces between your variable name, the equal character and the value you're assigning your variable with.

Then, to echo a variable, you would do:

echo $var
echo "$var"
echo "${var}"

The & character, in bash/sh, is used for "job control", which is yet another topic, ...

Start by using the following instead, tell us how it goes:

#! /bin/sh

while true;do
    var="$(echo "RDTEMP1" | netcat -q2 sanderpi 5033)"
    echo "$var"
    echo "$(date +%Y-%m-%d%t%H:%M:%S)"
done
Source Link
SYN
  • 2.9k
  • 14
  • 19

In shell, setting variables would be done with:

var1=toto
var2="$(echo toto | othercommand)"

You can't have spaces between your variable name, the equal character and the value you're assigning your variable.

Then, to echo a variable, you would do:

echo $var
echo "$var"
echo "${var}"

The & character, in bash/sh, is used for "job control", which is yet another topic, ...

Start by using the following instead, tell us how it goes:

#! /bin/sh

while true;do
    var="$(echo "RDTEMP1" | netcat -q2 sanderpi 5033)"
    echo "$var"
    echo "$(date +%Y-%m-%d%t%H:%M:%S)"
done