Home > Blockchain >  not been able to read the output
not been able to read the output

Time:10-22

I'm not able to read the output from the cat/etc/issue and use it to check if you are using the tested distro for one of my tools

#!/bin/bash
cat /etc/issue 
read distro   
echo $distro
if [[ "$distro" = "Debian GNU/Linux bookworm/sid \n \l" ]];
then
 echo "You are using Debian"
else
 echo "you are not using Debian some things may not work"
fi

CodePudding user response:

cat and read in your current script are completely independent.

Try read distro </etc/issue instead.

That said, grep is probably better suited to figure out if something contains a certain string, and /etc/os-release seems like a better source for what OS you're running.

  • Related