Reputation: 400
I am having two commands
hostname -f
and cat /sys/block/sda/size
Need to combined output like hostname:34345
I tried using
hostname -f && cat /sys/block/sda/size
But output is printing in two lines. Please help me to get the output as required
Upvotes: 1
Views: 70
Reputation: 157947
Assuming that you are using the bash
shell, you can use command substitution:
echo "$(hostname):$(cat /sys/block/sda/size)"
Upvotes: 2