Creating bashrc and vimrc using scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating bashrc and vimrc using scripting
# 1  
Old 12-07-2011
Creating bashrc and vimrc using scripting

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"

Code:
echo "stuff" >> .bashrc


Last edited by meredith1990; 12-07-2011 at 11:09 PM..
# 2  
Old 12-08-2011
why not try first?
# 3  
Old 12-08-2011
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.

# 4  
Old 12-08-2011
In what way did it "not work"?

Of course it won't work without the echo.
# 5  
Old 12-08-2011
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
Code:
"suff" > .vimrc

would work but it did not. if this whole thing does not make sense i can try and clerify.

Last edited by meredith1990; 12-08-2011 at 08:31 PM..
# 6  
Old 12-12-2011
Code:
"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:

Code:
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Double quote in vimrc not take as comment

Hi, 1. I'm using tcsh and I use a .gvimrc file which was working fine with my previous ksh shell. But while sourcing, I'm getting messages like 'Unmatched " '. I'm not trying anything fancy but just using " for commenting in the very first line and I see the error is thrown right there. 2.... (2 Replies)
Discussion started by: rishikpillai90
2 Replies

2. UNIX for Advanced & Expert Users

Vimrc creating tabs instead of spaces

I'm having trouble getting my vimrc to work the way I want it. For some reason after I hit enter it is creating tabs instead of spaces like I would expect. Here is an example of what I am talking about. $ = newline, ^I = tab. On the line of struct EDGETAG* q; I hit enter and it created a tab... (2 Replies)
Discussion started by: cokedude
2 Replies

3. Shell Programming and Scripting

Shell Scripting for creating ftp and transfer file

Dear All, We run backup script to update backup file every hour. I want to create a script, which transfer these files in another server using ftp as new backup file created every hour. Files should be stored with a unique name for every hour(e.g 20130708_13:00 , 20130708_14:00 and so on) and... (13 Replies)
Discussion started by: Preeti Saini
13 Replies

4. Shell Programming and Scripting

Difference between .vimrc and .exrc?

What is the difference between .vimrc and .exrc? I google it but didn't find the brief explanation? Regards ADI (2 Replies)
Discussion started by: adisky123
2 Replies

5. UNIX for Advanced & Expert Users

vimrc help with line endings

I was reading this and thought I could put this in my vimrc and it would convert the line endings to unix. Am I doing something wrong or am I missing something? set ff=unixManaging/Munging Line-Endings with Vi/Vim | Jeet Sukumaran I used this command and it confirms that my global option is... (2 Replies)
Discussion started by: cokedude
2 Replies

6. Solaris

editing crontab with vim and using .vimrc

Hi since we migrated from Solaris 8 to Solaris 10 I do miss a nice feature when editing crontab with vim editor: no more color highlighting after starting to edit. Well there is a hack, see below. I did define: export EDITOR='vim -c ":source /export/home/duc904/.vimrc"' Under Sol8 when... (2 Replies)
Discussion started by: duc904
2 Replies

7. Shell Programming and Scripting

bashrc

i have made a few changes to my bashrc file...have set a few environmental variable that my shell scripts use. Is there any way that these changes can reflect in evryone else's bashrc who are in the network or do all of them have to copy those changes to their own bashrc file. (2 Replies)
Discussion started by: lassimanji
2 Replies

8. Shell Programming and Scripting

VIMRC question ????

Hi There, :) I Need to put the following command in the vimrc for the execution of ECLIPSE so I have written smthing like as follows, export PATH=$PATH:/JVM location after this i go to my eclipse folder and when I execute STILL it is not getting opened..... Any Help that makes my... (6 Replies)
Discussion started by: gk_linux
6 Replies

9. Shell Programming and Scripting

bash/awk scripting help (creating OLD new users)

I need some help making this script... I guess I'm having trouble even interpretating what to even get started on... I need to create a script that will search a given directory (typically a user's home directory, but not necessarily) as provided on the command line and any sub-directors for... (2 Replies)
Discussion started by: Jukai
2 Replies

10. Shell Programming and Scripting

from bashrc to sh..??

:) as soon as i installed my software a couple of weeks ago.. (fedora core 2 vs, 2.6.8-1.521) i decided to switch the shell to sh shell and i know that .bashrc is the bash profile file(???) i want to use the sh version of the same file and make it the main profile file.. how can I switch it and... (3 Replies)
Discussion started by: moxxx68
3 Replies
Login or Register to Ask a Question