Results 1 to 2 of 2
Hello everybody.
I'm trying to make a bash script, that allows me to:
- Start grub-md5-crypt
- Enter a password
- Add the md5-value for that password to /boot/grub/menu.lst automatically
...
- 03-06-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 8
[SOLVED] [Bash] command output as variable (in GRUB)
Hello everybody.
I'm trying to make a bash script, that allows me to:
- Start grub-md5-crypt
- Enter a password
- Add the md5-value for that password to /boot/grub/menu.lst automatically
My problem is, that grub-md5-crypt is kinda weird, and gives an output like this:
I would like to just copy the md5-sum, and add it to my menu.lst.Code:$ grub-md5-crypt Password: (requires user action) Retype password: (requires user action) [md5-sum]
Does anybody know, how to do that? I was thinking about using grep, but haven't had any success yet.
I've noticed, that all md5-sums created by that command starts with $1$, if that should be any help.
- 03-06-2010 #2Just Joined!
- Join Date
- Mar 2010
- Posts
- 8
Okay, I figured it out myself:
Using var=$(openssl passwd -1) instead of var=$(grub-md5-crypt) I finally got it to work.
To help others, here's my script to make and add a MD5-encrypted password to /boot/grub/menu.lst:
Executing the above script in a console will work.Code:##!/bin/bash grub=/boot/grub/menu.lst var=$(openssl passwd -1) echo password --md5 $var >> $grub


