Take user input and then append to another file

Hi,

I have below line from the config file

$__MR_CONFIG['system']['database']['database_Primary']['username'] = 'userinput';

I want to get the value from the user for the "userinput" and then append the full line to another file.
Can you please let me know how can I proceed on this? I am new to unix and your help is greatly appreciated.

Thanks,

what you tried yet?

I tried echo and then redirect to another file after reading user input, but that seems to be not be copying full line.

read -p "Enter userinput maually                                           : " userinput

echo "\$__MR_CONFIG['system']['database']['database_Primary']['username'] = '$userinput';" > filename
1 Like