Quote:
Originally Posted by rabir
Dear All
I wanna try to write a bash script that automatically configure my linux server. But i need to know the commands that "disable all lines of that file or specific file that i mension it." as well as want to input my desired lies through bash commands.
|
To "disable all lines" you would simple comment out the lines (or blank them)
To blank the file, simple:
To comment out all lines:
Code:
sed -e 's/^/#/g' file > tmp && mv tmp file
To add your own text to something you most likely want "echo" along with "read":
Code:
echo -n "What is your hostname? "
read ANSWER
echo "Hostname: $ANSWER" >> file
That's the very basics. For anything more complicated you'll need to give more context to work with.