2 of 3 Markup.

Using Multiple Function to get an output in a single Line

I am trying to create output which keeps hostname,ssh protocol and root login information with bash script.

And I would like to do it with developing functions. I developed .sh but it does not work.

Could you please help me to find out where is the problem in this sh?

Server Version Red Hat 7

my expected output should be;

xyz|hostname|Protocol X|Root Access Denied

And I would like to start to output "xyz" in order to pars my out but.


 local tmpfile=$(mktemp)
         hostname > "$tmpfile"
 printf '%s' "$tmpfile"

 local infile="$1"

 cat /etc/ssh/sshd_config  | grep Protocol}


 local infile="$1"

 if [[ $(sudo cat /etc/ssh/sshd_config | grep -i "PermitRootLogin yes" | grep -v "#PermitRootLogin yes") = "PermitRootLogin yes" ]]; then
                       echo  $host
                       echo "Root Access Denied"


 tmpfile=$( host )

         host "$tmpfile"
         protocol "$tmpfile"
         rootlogin "$tmpfile"
 } > fonk.out

 rm -f "$tmpfile"