I am trying to write a bash script that will create a .bashrc and .vimrc. I was wondering if anyone would know how to do approach this. Would this work if there was no .bashrc file minus the "stuff"
echo "stuff" >> .bashrc
I am trying to write a bash script that will create a .bashrc and .vimrc. I was wondering if anyone would know how to do approach this. Would this work if there was no .bashrc file minus the "stuff"
echo "stuff" >> .bashrc
why not try first?
[LEFT]I did try it and it did not work but I am not sure how else to approach it. I got rid of the echo part and that did not work as well. I am completely stuck.
[/LEFT]
In what way did it "not work"?
Of course it won't work without the echo.
im not trying to echo it to the command line. I am trying to create a script that will create a .vimrc and .bashrc but i can not figure out how to do this. i thought that
"suff" > .vimrc
would work but it did not. if this whole thing does not make sense i can try and clerify.
"stuff" > ~/.vimrc
tries to execute the command stuff which will, if you're lucky, give you "command not found'. If you're unlucky the system will find a command named stuff and happily execute it with unknown results, saving its output into ~/.vimrc.
If you want to print the text, echo "stuff"
will print the text stuff. That's why you need the echo.
If you want to print it to a different destination than your terminal, echo "stuff" > ~/.vimrc
If you want to feed multiple lines into ~/.vimrc, you can use a here-document:
cat <<EOF > ~/.vimrc
line1
line2
line3
EOF
Note the EOF must be at the beginning of the line or the here-document won't end properly.