.bashrc is the primary configuration file for the bash shell.

learn more… | top users | synonyms

1
vote
2answers
377 views

.bashrc file syntax error near unexpected token `('

I have been using the following lines in my bashrc file for quite some time now and suddenly now I have an error. Here are the lines: make() { /usr/bin/make "$@" 2>&1 | sed -E -e ...
1
vote
1answer
23 views

Debian : Setting path for Node with root accessible globally

I have downloaded NodeJS setup and have it inside at /home/deploy/nodejs. I am trying to set its path, but it's not working out. I am logged in as root, and I would like to access nodejs and npm ...
2
votes
1answer
501 views

How to use history commands with readonly PROMPT_COMMAND?

I'm sometimes logged in on a host which I do not control and where PROMPT_COMMAND is readonly. Is there some way to work around this to run history commands anyway, for example using PS1? I've tried ...
1
vote
1answer
20 views

Where are the places the PROMPT_COMMAND variable could be set?

I installed drush and as part of the installation it makes some changes to the PROMPT ... # Optional. Enrich the bash startup file with completion and aliases. drush init ... Whenever I execute an ...
0
votes
1answer
31 views

Showing color in log output using tail command when using Cygwin?

I have a debian install that runs an application server. I ssh into this debian install from a Windows computer using cygwin and with the application server running I use tail -f to monitor the log ...
0
votes
1answer
18 views

Mess with an export PATH

I have tried to include INTEL PARALLEL COMPOSER to my .bashrc.But something went wrong.Now I can not use gedit or vi editor. milenko@milenko-HP-Compaq-6830s:~$ gedit .bashrc Command 'gedit' is ...
6
votes
1answer
3k views

Problems with automatically starting screen on SSH login

I'm looking at http://taint.org/wk/RemoteLoginAutoScreen to setup my server so it autostarts a screen session when I login via SSH. I have added the following to my .bashrc: # Auto-screen ...
0
votes
1answer
25 views

Using export USER=myName doesn't change the output of whoami

I saw this example $ whoami MatsP $ g++ -Wall -std=c++0x getenv.cpp $ ./a.out MatsP $ export USER=DonaldDuck $ ./a.out DonaldDuck but for me it doesn't work. I am in a Debian machine. I used ...
1
vote
1answer
128 views

Why doesn't my bash terminal recognize any command in the shell? [closed]

Upon the request of some users, I decided to add all the intermediate steps and results to my initial post so that users can better walk me through a solution. This is added under the headline ...
3
votes
1answer
126 views

Does “color” in TERM always mean I can use colors?

Should the following always indicate that I can use escape sequences and tput to colorize things? if [[ $TERM == *"color"* ]]; then true else false fi
1
vote
1answer
36 views

How can I source several files into my .bashrc?

I want to write my functions each in separate files, for easier version control, and source the whole lot of them in my .bashrc. Is there a more robust way than e.g. . ~/.bash_functions/*.sh ?
0
votes
1answer
37 views

I need to know about 'source' and the use of 'bashrc' in context to installing any package in ROS

I am trying to install Robot Operating system (ROS)in my system. At some point I need to use the following: echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc Then the following source ...
0
votes
2answers
44 views

ls, mv, cp, cat, vi, command not found

I was trying to add a new path to my bashrc file but I have seemed to messed something up. after I $ source ~/.bashrc I no longer can use the commands ls, mv, cp, cat, vi, and probably others that I ...
364
votes
8answers
675k views

How to correctly add a path to PATH?

I'm wondering where a new path has to be added to the PATH environment variable. I know this can be accomplished by editing .bashrc (for example), but it's not clear how to do this. This way: export ...
1
vote
1answer
47 views

Capture Linux shell Commands to file

I'm trying to capture all Linux Shell command to some file. I tried to use the auditd service but it's not giving me the output I want. I searched a little and found some nice solution . Step 1: vi ...
2
votes
3answers
99 views

Trying to understand .bashrc, env, and export

Disclaimer: Using bash. I just need some confirmation / correction on my understanding of these things: env is basically displaying the current environmental variables that are accessible to my ...
1
vote
1answer
36 views

How to execute in-line commands through ssh

I'm struggling to execute commands through ssh, especially aliased command. The alias I need is ldocker which is set in the remote .bashrc. So far I tried: $ssh bugs2 '. .bashrc && echo ...
3
votes
1answer
38 views

Sourcing .bashrc from ssh after removing the prompt string check

I have a .bashrc file that needs to be sourced non-interactively. The problem is that on the file there is this return statement preventing from sourcing by code: [ -z "$PS1" ] && return ...
2
votes
2answers
36 views

How can Bash determine if it is running due to an rsync over ssh?

I need my Bash init scripts to be able to distinguish between having been invoked like ssh me@host /some/complicated/operation, and having been invoked like rsync -e ssh /src me@host:/dest In the ...
14
votes
8answers
26k views

Doing simple math on the command line using bash functions: $1 divided by $2 (using bc perhaps)

Sometimes I need to divide one number by another. It would be great if I could just define a bash function for this. So far, I am forced to use expressions like echo 'scale=25;65320/670' | bc but ...
1
vote
0answers
129 views

tmux not executing ~/.bash_profile on start up

I searched the net and many people complained that tmux wasn't executing their .bashrc. The solution thats suggested everywhere was to source .bashrc from within .bash_profile cos tmux launches bash ...
-2
votes
1answer
43 views

bash: syntax error near unexpected token `“firsttry.c”' [closed]

My code--- #include <stdio.h> int main(void) { printf("hello, world\n"); } and I get bash: syntax error near unexpected token `"firsttry.c"'
0
votes
1answer
54 views

how to get terminal to show root prompt in su

I am logged into a (normal) user, but when I go su : password my normal promt goes into showing me this instead of what it should. how to I fix this? ターミナル 10:15 AM (~) $ su Password: ...
0
votes
3answers
60 views

Add PATH to .bashrc

I am trying to install Anaconda on my Linux machine. Right or wrong, at the end of the instructions they say to add this line to the file .bashrc in your home directory: export ...
2
votes
2answers
147 views

Bash: #: command not found

I just moved to Arch Linux with KDE a week ago. Everything worked well until I installed ibus-unikey and ibus-qt, after that, whenever I open konsole, this error appears: bash: #: command not found ...
3
votes
2answers
131 views

Can I concatenate a bash alias?

Sample : to use Composer locally, I must write : php composer.phar After some locals installation of Composer, I want to alias it only "composer" but keeping absolute path with "pwd" command. I ...
20
votes
3answers
1k views

Why does bashrc check whether the current shell is interactive?

On my Arch install, /etc/bash.bashrc and /etc/skel/.bashrc contain these lines: # If not running interactively, don't do anything [[ $- != *i* ]] && return On Debian, /etc/bash.bashrc has: ...
0
votes
0answers
60 views

Debian: mvn command not found

I am attempting to install Maven in my Debian 7 environment, but even having followed the instructions from this video, I can't seem to get Maven working. I have the folder apache-maven-3.1.1 in my ...
3
votes
2answers
93 views

Handling duplicate programs names bash

I'm wondering if $PATH cascades entries. You'll all need to take a leap of faith with me here, but here it goes. Let's say we have a Java executable at /usr/bin/java but this version is very old and ...
19
votes
3answers
3k views

How can I create a local function in my bashrc?

My .bashrc had some code that was repetitive so I used a function to simplify it do_stuff() { local version=$1 export FOO_${version}_X="17" export FOO_${version}_Y="42" } do_stuff '5.1' ...
1
vote
5answers
53 views

remove an added path from PATH?

in my ~/.bashrc in Linux , I have a line that adds some paths to PATH, something like: PATH=~/mydoc:~/mypython:"$PATH" The purpose of adding ~/mypython is to use my self-installed python, rather ...
0
votes
1answer
70 views

How to create a dynamic greeting?

Recently made the switch to Linux/command line, and I'm having trouble creating a dynamic greeting for terminal out of a list of predetermined possibilities. I tried the following, but it appears as ...
0
votes
1answer
25 views

Logged into RHEL 6 and profile settings are missing

I know there's not much detail I'll be able to provide, but if the info below could give you a hint of what is going on, please help. A colleague was sharing screen with me yesterday, using RHEL's ...
0
votes
1answer
59 views

Why don't I get my bash customizations when I log in normally?

My user's shell prompt is stuck as [bash-4.2]$ and many useful commands like ll don't work on that bash-4.2 shell. I tried the chsh command and usermod commands, but neither fixed this. I've checked ...
1
vote
1answer
38 views

A command that takes a single numeric argument and prints out the day of the week based on the formula

days=('Sunday''Monday') days=('Tuesday''Wednesday') days=('Thursday''Friday') days=('Saturday') for numbers in "S@"; do if [ $numbers -ge 0 ]; then result=$(($numbers ...
3
votes
1answer
71 views

Start all terminal sessions within /usr/bin/script

I would like to expend some disk space recording all input and output to my terminal sessions; /usr/bin/script appears to be fairly good at that. I would like to make it so all new shell sessions ...
6
votes
2answers
11k views

sftp gives an error: “Received message too long” and what is the reason?

I was able to do sftp yesterday to a RHEL 5.4 box (RedHat) and today I can't. The message is "Received message too long 778199411", and after some investigation, it was due to my RHEL box's .bashrc ...
1
vote
1answer
75 views

How can I use debian_chroot in bashrc to identify the chroot env?

I see the following in ~/.bashrc : if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi which means if the variable is ...
3
votes
1answer
127 views

To export or not to export bash PS1 variable

I just spent a lot of time reading up on login and interactive shells and why one should or should not set environment variables, shell functions, etc. in the various profile and bashrc files. In this ...
0
votes
0answers
32 views

Fill the name of last-run program in Bash

Suppose I execute some command: ls -l ~/some_dir. I would like to create an alias, such that I could execute man with the name of the last-run program as a parameter, i.e., man ls in this case. ...
0
votes
1answer
126 views

How to remove the return code from the terminal prompt in Sugar on a Stick?

I am using Sugar on a Stick (Fedora 23) 0.106 for i686 as a distro. Here's the link to the website of this distro: https://sugarlabs.org When I use the terminal I get a very weird behaviour. For ...
0
votes
1answer
59 views

Bash: Tab completion with cdable_vars

I've been relying on this hack for jumping around in the file system for a couple of years before finding out today that I can do the same thing using native Bash by activating the option cdable_vars. ...
2
votes
1answer
4k views

When I run “sudo su” I get --bash: command not found for everything

I'm not good with command lines or servers. But I needed to configure for work a AMI of EC2 AWS with LINUX So I've installed a lot of stuff, moved a lot of stuff around and then I realized that sudo ...
3
votes
2answers
379 views

what is the command [ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh” doing

I found the following command in the .profile file while installing node through nvm: [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" I want to know what is the the purpose of [] and ...
22
votes
8answers
19k views

How can I set my default shell to start up tmux

I would like my default bash shell to go straight into tmux instead of my always having to type tmux every time.
0
votes
0answers
72 views

Bash prompt time is not always updating

Before I start, this is not a question about how to customize PS1. I have already customized mine and I'm quite happy with it. I usually work in a remote server with SuperPuTTY, which allows me to ...
2
votes
1answer
42 views

building code from source and adding them to your path

Typically on Debian when you install things from the repository, they just work. It sets up things just fine and life is good. This is great for things that are up to date in the repository. I am ...
0
votes
1answer
69 views

unexpected EOF error while running bash_profile [closed]

I am a newbie to Linux and I am trying to install a software in my university cluster via ssh login from my PC. So, I first login via ssh, and then according to the software documentation I add the ...
9
votes
2answers
6k views

Bash doesn't read .bashrc unless manually started

bash won't source .bashrc from an interactive terminal unless I manually run bash from a terminal: $ bash or manually source it: $ source ./.bashrc or running: $ st -e bash Here's some useful ...
2
votes
2answers
324 views

How do I get ~/.bashrc to execute all scripts in my ~/Shell directory using a loop?

I have shell scripts in my ~/Shell directory that I want to be run whenever Bash is started up as my usual user account. So what I have done is added the following to ~/.bashrc: for i in `find ...