Sample Header Ad - 728x90

Echo out a specific word in bash

0 votes
3 answers
1139 views
Basically, i have a bunch of commands in bash that are asking my machine the information of it. Like: > host=$(hostname -A) hostname=$(hostname -I) Pub_IP=$(dig +short myip.opendns.com @resolver1.opendns.com) Kernel_Version=$(uname -v | awk -F"Debian" '{print $2}' | cut -d ' ' -f2 | cut -d '-' -f1) Deb_Version=$(cat /etc/debian_version) I am also echoing it echo $host $hostname $Pub_IP $Kernel_Version $Deb_Version > info.txt What i need to figure out is how i can put | between each of the parameter. So if i look into my info.txt file, it would look something like | debianmachine | output_of_hostname | output_of_Pub_IP | Also, i might be able to do this with print?
Asked by TheSebM8 (471 rep)
Mar 22, 2018, 08:10 AM
Last activity: Sep 28, 2024, 06:18 PM