ylliX - Online Advertising Network
Vertex AI - Antrophic and Mistral models: Why does it require Imegen access?

environment variable not read in sed


I am trying to update sudoers via script and passing the value of $HOSTNAME and it’s not working..obviously missing something.

I am expecting:
%[email protected] ALL=(ALL:ALL) ALL
%[email protected] ALL=(ALL:ALL) ALL

Below are the many attempts and results:
sed -i “/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n””%”${HOSTNAME}”[email protected] ALL=(ALL:ALL) ALL” /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%[email protected] ALL=(ALL:ALL) ALL

sed -i “/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n%${HOSTNAME}[email protected] ALL=(ALL:ALL) ALL” /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%[email protected] ALL=(ALL:ALL) ALL

sed -i “/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n%”${HOSTNAME}”[email protected] ALL=(ALL:ALL) ALL” /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%[email protected] ALL=(ALL:ALL) ALL

sed -i “/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n%’${HOSTNAME}’[email protected] ALL=(ALL:ALL) ALL” /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%”[email protected] ALL=(ALL:ALL) ALL

sed -i “/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n%’$HOSTNAME’[email protected] ALL=(ALL:ALL) ALL” /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%”[email protected] ALL=(ALL:ALL) ALL

sed -i “/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n%”$HOSTNAME”[email protected] ALL=(ALL:ALL) ALL” /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%[email protected] ALL=(ALL:ALL) ALL

sed -i ‘/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n'”%{$HOSTNAME}”‘[email protected] ALL=(ALL:ALL) ALL’ /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%{}[email protected] ALL=(ALL:ALL) ALL

sed -i ‘/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n%'”$HOSTNAME”‘[email protected] ALL=(ALL:ALL) ALL’ /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%[email protected] ALL=(ALL:ALL) ALL

sed -i “/#My Customization.*/a%[email protected] ALL=(ALL:ALL) ALL\n%””${HOSTNAME}””[email protected] ALL=(ALL:ALL) ALL” /tmp/sudoers.bak1

Returns:
%[email protected] ALL=(ALL:ALL) ALL
%[email protected] ALL=(ALL:ALL) ALL



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *