Stewart
Guru
- Joined
- Sep 16, 2009
- Messages
- 603
- Reaction score
- 6
I'm trying to write some scripts that allow greater logging and notification but for some reason can't get my commands to store the results in a variable. Running:
results in:
System uptime: 37 minutes, 23 seconds
Last reload: 37 minutes, 23 seconds
But if I run either
or
I get what seems to be a blank line.
Any ideas as to what I'm doing wrong?
Code:
asterisk -rx "core show uptime"
System uptime: 37 minutes, 23 seconds
Last reload: 37 minutes, 23 seconds
But if I run either
Code:
VAR1=$(/usr/sbin/asterisk -rx "core show uptime") | echo $VAR1
Code:
VAR1=$(/usr/sbin/asterisk -rx "core show uptime" | grep uptime) | echo $VAR1
Any ideas as to what I'm doing wrong?