2

I am running a bioinformatics course that gave the following instructions to setup my previously non-existing bash profile:

You will need a few lines in your setup files. Open a Terminal and run the following:

curl http://data.biostarhandbook.com/install/bash_profile.txt >> ~/.bash_profile
curl http://data.biostarhandbook.com/install/bashrc.txt >> ~/.bashrc

These commands will update your so-called “shell” (see later) to behave more consistently. If you want the details read the Setting the Bash profile page. Do not run this terminal initialization command above more than once!

By mistake I ran the command twice. Now every time I open the terminal it prints "process completed".

Trying to find the issue using /bin/bash -x I found:

Last login: Sat Dec 28 17:43:22 on ttys001
+ '[' -x /usr/libexec/path_helper ']'
++ /usr/libexec/path_helper -s
+ eval 'PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin";'
export 'PATH;'
++ PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
++ export PATH
+ '[' /bin/bash '!=' no ']'
+ '[' -r /etc/bashrc ']'
+ . /etc/bashrc
++ '[' -z '\s-\v\$ ' ']'
++ PS1='\h:\W \u\$ '
++ shopt -s checkwinsize
++ '[' -r /etc/bashrc_Apple_Terminal ']'
++ . /etc/bashrc_Apple_Terminal
+++ '[' -z '' ']'
+++ PROMPT_COMMAND=update_terminal_cwd
+++ '[' 0 -eq 0 ']'
+++ '[' -n F255D8F8-2CB8-4EE0-9020-34B81CF28789 ']'
+++ '[' '!' -e /Users/benoitduc/.bash_sessions_disable ']'
+++ SHELL_SESSION_DID_INIT=1
+++ SHELL_SESSION_DIR=/Users/benoitduc/.bash_sessions
+++ SHELL_SESSION_FILE=/Users/benoitduc/.bash_sessions/F255D8F8-2CB8-4EE0-9020-34B81CF28789.session
+++ mkdir -m 700 -p /Users/benoitduc/.bash_sessions
+++ '[' -r /Users/benoitduc/.bash_sessions/F255D8F8-2CB8-4EE0-9020-34B81CF28789.session
']'
+++ '[' 1 -eq 1 ']'
+++ SHELL_SESSION_HISTFILE=/Users/benoitduc/.bash_sessions/F255D8F8-2CB8-4EE0-9020-34B81CF28789.history
+++ SHELL_SESSION_HISTFILE_NEW=/Users/benoitduc/.bash_sessions/F255D8F8-2CB8-4EE0-9020-34B81CF28789.historynew
+++ SHELL_SESSION_HISTFILE_SHARED=/Users/benoitduc/.bash_history
+++ '[' -s /Users/benoitduc/.bash_sessions/F255D8F8-2CB8-4EE0-9020-34B81CF28789.history
']'
+++ PROMPT_COMMAND='shell_session_history_check; update_terminal_cwd'
+++ SHELL_SESSION_TIMESTAMP_FILE=/Users/benoitduc/.bash_sessions/_expiration_check_timestamp
+++ trap shell_session_update EXIT
+ '[' -f /Users/benoitduc/.bashrc ']'
+ source /Users/benoitduc/.bashrc
++ '[' -f /Users/benoitduc/.bashrc ']'
++ source /Users/benoitduc/.bashrc
+++ '[' -f /Users/benoitduc/.bashrc ']'
+++ source /Users/benoitduc/.bashrc
++++ '[' -f /Users/benoitduc/.bashrc ']'
++++ source /Users/benoitduc/.bashrc
...
...

If anyone can help me it would be welcome.

2
  • 1
    Running both commands more than once doesn't have any harmful impact if .bashrc/.bash_profile were emtpy/non-existent previously - except that the files get bloated. Any error is related to previous content of .bashrc/.bash_profile. Please add their content to the question by editing it. – klanomath Dec 28 '19 at 17:27
  • 1
    The dyad probably contains some recursive sourcing (.bashrc sources .bash_profile and the other way round - the latter was injected by curl http://data.biostarhandbook.com/install/bash_profile.txt >> ~/.bash_profile). – klanomath Dec 28 '19 at 17:43
1

To find what was added to your profiles, I ran these commands.

mac $ curl http://data.biostarhandbook.com/install/bash_profile.txt > ~/seebash_profile
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    89  100    89    0     0    513      0 --:--:-- --:--:-- --:--:--   514
mac $ curl http://data.biostarhandbook.com/install/bashrc.txt > ~/seebashrc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   759  100   759    0     0  17574      0 --:--:-- --:--:-- --:--:-- 17651
mac $ cat seebash_profile 
#
# Source the settings from .bashrc.
#
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi
mac $ cat seebash_profile 
#
# Source the settings from .bashrc.
#
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi
mac $ 

You get two copies of these lines in each file. You should get rid of one copy in each file. nano is a simple editor you can use to edit these files.

https://linuxize.com/post/how-to-use-nano-text-editor/

1
  • This solution worked very well for me using the nano editor. Thanks a lot! – ben_duck Dec 31 '19 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .