sed + replace value default in grub.conf [closed]

I want to change the default value on all machines to default=0

default value could be any integer number

how to set in the sed syntax that default could be any number

my example ( not working )

for server_ip in $all_servers
   do
   ssh $server_ip  "sed -i s'/default=[0-9]/default=0/g' /etc/grub.conf"
done

example of grub.conf

  more /etc/grub.conf
  # grub.conf generated by anaconda
  #
  # Note that you do not have to rerun grub after making changes to this     file
  # NOTICE:  You have a /boot partition.  This means that
  #          all kernel and initrd paths are relative to /boot/, eg.
  #          root (hd0,0)
  #          kernel /vmlinuz-version ro root=/dev/rootvg/slash
  #          initrd /initrd-version.img
  #boot=/dev/cciss/c0d0
  default=2

Answer

The script in the original version of your question contained an error in that the variable name all-servers is illegal. The - character is not allowed in a shell variable name.

Valid characters are [A-Za-z0-9_].

Attribution
Source : Link , Question Author : dandan , Answer Author : Community

Leave a Comment