0

I need to create an easy to go Debian VM for new developers on my team. I run a script on boot with rc.local.

This is a small test script :

#!/bin/bash

exec < /dev/tty1

# Checking if user default exists    
if id -u "default" 1>/dev/null 2>&1; then
    echo "VM is not initialized"
else
    echo "VM is initialized"
fi

# Trying to prompt user
read -p "Hello : " world

# Checking user input   
echo "Hello $world"

exit 0

My main issue is that I can prompt user with exec < /dev/tty1 but I can't display anything with echo "Hello $world" or read -p "Hello : " world.

I already manage to execute a script before gui boot with rc.local. I need to ask for user information to perform some configurations.

The script in my first message is just a test. Actually, the script prompt works but the prompt message and the echo that follows do not display since I needed to use exec < /dev/tty1 for the prompt to work. Now, I need to find a solution to be able to prompt user and to display messages.

  • 1
    What are you actually trying to do? – roaima Jun 14 at 22:01
  • Welcome to Unix & Linux Stack Exchange.  It would appear that you have accidentally created two accounts.  This will interfere with commenting, editing your own posts, and accepting an answer.  You should use the contact form and select ‘‘I need to merge user profiles’’ to have your accounts merged.  In order to merge them, you will need to provide links to the accounts.  For your information, they are unix.stackexchange.com/users/357921/defmsy and unix.stackexchange.com/users/357923/defmsy.  You’ll then be able to edit your question. – Scott Jun 16 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.