Tag Info

Hot answers tagged


Traditionally, when you log into a Unix system, the system would start one program for you. That program is a shell, i.e., a program designed to start other programs. It's a command line shell: you start another program by typing its name. The default shell, a Bourne shell, reads commands from ~/.profile when it is invoked as the login shell. Bash is a ...


Regarding the problem with .bashrc above: On most systems, ~/.bashrc is only used when starting an interactive non-login shell. However, when you start up a new shell it is often an interactive login shell. Since this is a login shell, the .bashrc is ignored. To keep the environment consistent between non-login and login shells, you must source the .bashrc ...


So turns out that on Mac OS X Snow Leopard as well as Mac OS X Lion, the file that's loaded is called .profile, not .bashrc. What you want to do is create a file in ~/.profile and call it .profile (if it doesn't already exists). Put whatever information you needed to load with each instance of bash there (Thanks, thepurplepixel). A couple of side notes: ...


From this short article According to the bash man page, .bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells. What is a login or non-login shell? When you login (eg: type username and password) via console, either physically sitting at the machine when booting, or remotely via ssh: ...


When you open up your Git Bash, you should be by default in your home directory. Now create the .bashrc file (if on Win7 the file should be named .bashrc.). If you're not in the home directory change into it with: cd You can create the file with: touch .bashrc Then edit it with vim or you could try doing it with some windows editor, but i don't ...


Back in the old days, when pseudo tty's weren't pseudo and actually, well, typed, and UNIXes were accessed by modems so slow you could see each letter being printed to your screen, efficiency was paramount. To help efficiency somewhat you had a concept of a main login window and whatever other windows you used to actually work. In your main window, you'd ...


bash is probably getting started as a login shell, in which case it doesn't read .bashrc automatically. Instead, it reads .bash_profile. From the Bash manual: So, typically, your `~/.bash_profile' contains the line `if [ -f ~/.bashrc ]; then . ~/.bashrc; fi' after (or before) any login-specific initializations. So in summary, create a ...


The following should work: function cd() { builtin cd "$@" && ls -l; } Since the function is on a single line, ensure that it is terminated with ; as above in order to work correctly.


You could simply add the following command into System > Preferences > Startup Applications: bash /full/path/to/your/script.sh That should do the trick ;)


~/.bash_profile DROPBOX_PROFILE='~/Dropbox/Bash/.bash_profile' if [ -f $DROPBOX_PROFILE ]; then . $DROPBOX_PROFILE fi ~/.emacs (load "~/Dropbox/Emacs/.emacs")


Seeing "Broken pipe" in this situation is rare, but normal. When you run type rvm | head -1, bash executes type rvm in one process, head -1 in another.1 The stdout of type is connected to the "write" end of a pipe, the stdin of head to the "read" end. Both processes run at the same time. The head -1 process reads data from stdin (usually in chunks of 8 ...


Assuming you’ve verified that it’s a login shell (shopt login_shell): ~/.bash_logout is only run if it you explicitly exit the shell with exit or logout, or by typing Control-D to enter an end-of-file at the command prompt. If you close the terminal emulator, processes are sent SIGHUP, and bash doesn’t run ~/.bash_logout in that case. If you want to ...


On a modern system it is not especially common to run into the cases where it matters, but it does happen. (In particular, if you use shell operations in vim such as :r !command or the in-line !<motion>command form.) What would you put under ~/.bashrc? only aliases? You put things in ~/.bashrc that would not be inherited by subshells ...


You have to make your own .bashrc. You can simply use a text editor to make a file called .bashrc (no extension) with the contents you want and save it in your home directory (/Users/YourUserName/).


I think you're running into a loop. Your cd function is calling cd, which is... the function You need to know about builtin which is a keyword which makes command lookup use the the Bash builtins like cd and not your function function cd { builtin cd "$1" : do something else } Also, calling /usr/bin/cd will never work, even if such a command ...


Perhaps you accidentally ran this from csh? $ csh lucid32:~> source if_rc if: Expression Syntax. lucid32:~> cat if_rc if [ -f /etc/bashrc ]; then : fi


So basically, as nodiscc suggested, create a desktop launcher: ~/.config/autostart/script.desktop with the following contents: [Desktop Entry] Type=Application Name=Autostart Script Exec=autostart Icon=system-run X-GNOME-Autostart-enabled=true Then create the autostart script: ~/bin/autostart with your bash contents: #!/bin/bash # Execute bash script ...


Use a function instead: function quit { osascript <<EOF tell application "$*" to quit EOF }


How about this, which avoids having special config files that source the Dropbox versions? $ ln -s ~/Dropbox/Bash/.bash_profile ~/.bash_profile $ ln -s ~/Dropbox/Emacs/.emacs ~/.emacs


Temporarily fix the PATH, directly in the broken shell: export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin (This is my PATH, it should mostly work for you as well) Give yourself write permissions for that file, with or without fixing PATH as above: /usr/bin/sudo /bin/chmod u+rwx ...


In bash, alias sudo='sudo ' will cause bash to expand any aliases that come after sudo.


Summarizing from the other suggestions: Put this in your .bashrc (or preferably, .bash_aliases): alias ls="ls -F --color=auto" Also, a good read would be man dircolors.


Add the following line at the end of ~/.bash_profile or ~/.bashrc, whichever exists: PS1="\n$PS1" This will add a newline before a prompt is printed, which is after control is returned to the shell. Unless your command prompt contains shell commands or variables (which would get executed/interpreted at the time of variable assignment), this will work. ...


You should edit your ~/.bashrc, and add something like: export PATH=$PATH:/path/to/bin


⇧⌘. shows hidden files in file dialogs. You could try opening ~/.bash_profile with TextEdit and making it blank temporarily.


You can put .bash_profile in your user directory: C:\Users\<username>. You can also create some git-only aliases so you can do just git st for git status by adding these lines to C:\Users\<username>\.gitconfig: [alias] st = status Some other useful aliases: cm = commit -m cma = commit -a -m br = branch co = checkout df = diff ls = ls-files ...


As discussed in Why ~/.bash_profile is not getting sourced when opening a terminal? on “Ask Ubuntu”, the shell running under tmux is not a login shell. How can I tell whether a shell is a “login shell”? Try typing “logout”.  If the shell terminates, it was a login shell.  If it says it isn’t a login shell, then it isn’t. Type “ps -fp$$”.  ...


Here is defined an alias solr which will cd to the named directory-: alias solr='cd /Applications/MAMP/htdocs/whoat/solr/whoat' Note the use of single quotes - double quotes will cause the cd to go to to the home directory. I sometimes prefer to add a pwd to the alias as a check and reminder of what the current working directory is-: alias solr='cd ...


Links To create links, you use the ln command. See man ln. You could do it like ln -s /Applications/MAMP/htdocs/whoat/solr/whoat /where/you/want/link, where: The first path is what you are linking The second path is where the link will be Directory Navigation man cd There are two ways to navigate with cd, absolute and relative. The easiest way to ...

Only top voted, non community-wiki answers of a minimum length are eligible