Read -p problem

Hi, :slight_smile:

I tried to make of "line returns" with "\n" :

read -p $'Do you really want append this line in '$CONFIG_FILE''\n'IP CLIENT: '$IP_INPUT'   -   PATH: '$PATH_INPUT''\n'y/n ?:' CONFIRM_INPUT

But it didn't work, please anyone have an idea? :b:

One way:

read -p "Do you really want append this line in $CONFIG_FILE
$IP CLIENT: $IP_INPUT   -   PATH: $PATH_INPUT
y/n ?:" CONFIRM_INPUT

Another way:

read -p "Do you really want append this line in $CONFIG_FILE"$'\n'"$IP CLIENT: $IP_INPUT   -   PATH: $PATH_INPUT"$'\n'"y/n ?:" CONFIRM_INPUT

--
Or, without -p:

printf 'Do you really want append this line in %s\n%s CLIENT: %s   -   PATH: %s\ny/n ?:' "$CONFIG_FILE" "$IP" "$IP_INPUT" "$PATH_INPUT"
read CONFIRM_INPUT
3 Likes

Thank you !