LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   making alias, can't find .bashrc file (https://www.linuxquestions.org/questions/slackware-14/making-alias-cant-find-bashrc-file-208279/)

djgerbavore 07-22-2004 08:55 AM

making alias, can't find .bashrc file
 
i'm using kernels 2.4.24 on slackware 9.1, and i want to start making alias for my bash shell. but when i go to my home directory i can't find that find.
i even did a ls -a command and still no file. does slackware put the bash profiles stuff somewhere else?

oot 07-22-2004 08:58 AM

Just create it. If it's there, it will be used. If it isn't there, it will be ignored and /etc/profile will be used.

djgerbavore 07-22-2004 09:20 AM

so i can touch ~/.bashrc
and just type:
alias cp='cp -iv'

save it, and be able to use it on the fly.

oot 07-22-2004 09:58 AM

Yes and no. You need to give it a first line of #!/bin/bash.
So, what you'd end up with is
Code:

#!/bin/bash
alias cp='cp -iv'


djgerbavore 07-22-2004 10:07 AM

sweet thanks, i'm gonna try that when i get home from work. i love this website!!

mijenks 07-22-2004 10:42 AM

Slack (at least as of 9.1) does not create a .bashrc file for you, you have to create it yourself. I'm not too sure that you even need to put #!/bin/bash in the file, but it can't hurt, I'm sure. Good luck.

djgerbavore 07-22-2004 10:45 AM

do you know why slackware 9.1 doesn't include a .bashrc file? that seems sort of werid

oot 07-22-2004 05:30 PM

It doesn't include it because it can use /etc/profile instead. If all users start off with the same default settings, there's no reason to duplicate the settings in a lot of files, so everyone gets /etc/profile to start off with. If they want to customize, that's what .bashrc and .profile are for.

Speaking of which -- djgerbavore -- I may have told you wrong on which file to use. It depends on when you want it to run. If you use .bashrc, when you log in, it apparently won't run, but when you launch an xterm, it will. If you use .profile, when you log in, it will run, but it will not run when you launch an xterm. If you want it to run for both a terminal where you log in AND an xterm, then you need to put the same thing in BOTH .bashrc and .profile. Sorry I wasn't clearer about this earlier.

perry 07-22-2004 05:39 PM

Get Slacked!
 
Quote:

Originally posted by djgerbavore
do you know why slackware 9.1 doesn't include a .bashrc file? that seems sort of werid
in comparison to other distros, yes that does seem a little bit silly not to include something as basic as this.... but you... now you've learned something new!

and this is actually i think the number one reason why people get hooked on Slackware... always something new to learn and with it comes the sense that you actually know what you at!

so just keep on Slacking!

- perry

Bebo 07-22-2004 05:47 PM

I've solved this .bashrc and .profile thing by creating an /etc/bashrc file which I source from within /etc/profile. And then I make a symlink from ~/.bashrc to /etc/profile. That way, every user will have the same aliases and stuff, independent on whether it is a login shell or interactive shell, or whatever.

djgerbavore 07-23-2004 08:23 AM

hey thanks guys, i got it working. slackers are the most helpful people. i think that is why i like slackware so much. thank guys. time to party.


All times are GMT -5. The time now is 12:43 AM.