Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Bash was the default shell in macOS until 2019 when it was depreciated in lieu of zsh in macOS 10.15 Catalina.

Bash is a command processor, which means that the user inputs text commands at a prompt. Like the majority of Unix shells, it supports filename wildcarding, piping, here documents, command substitution, variables and control structures for condition-testing and iteration. Almost all of the syntax was copied from the sh shell. The current major version of Bash is version 4.

1735 questions
470
votes
15 answers

git auto-complete for *branches* at the command line?

On my Linux machine I have autocomplete for branches with Git. [Note we are talking about git branch completion, not bash completion (e.g. commands, files, etc). Thus NOT Lane's answer at all] For example I can type git checkout+TAB and get a list…
Michael Durrant
  • 16,996
  • 20
  • 48
  • 71
408
votes
5 answers

What is the difference between .bash_profile and .bashrc?

To make an alias for the Terminal in OS X, you can either put the aliases in .bash_profile or .bashrc. What is the difference between the two and why would I choose to put aliases in one and not the other?
daviesgeek
  • 37,296
  • 51
  • 158
  • 200
370
votes
7 answers

How do I recompile Bash to avoid Shellshock (the remote exploit CVE-2014-6271 and CVE-2014-7169)?

Given that Bash 3.2 (the version shipped by OS X) is vulnerable to the remote execution exploit known as "Shell Shock" (CVE-2014-6271 and CVE-2014-7169) how do I rebuild Bash and secure my system ahead of an official Apple patch? UPDATE: Note that…
AlBlue
  • 2,705
  • 4
  • 16
  • 17
304
votes
4 answers

What are the practical differences between Bash and Zsh?

With the news that Catalina will default to Zsh instead of Bash, I'm finding lots of results telling me about the switch, and that it may cause problems with shell scripts, but I'm not familiar enough with Zsh to know what those problems might…
dr.nixon
  • 5,228
  • 3
  • 17
  • 24
272
votes
13 answers

Why doesn't .bashrc run automatically?

I put some alias commands in my .bashrc file, so that they might be loaded everytime I open a new Terminal window. Yet this doesn't happen. I have to select run script: in the Terminal>Preferences>"MyDefaultTheme">Shell prefpane and add: source…
romeovs
  • 4,143
  • 8
  • 23
  • 32
186
votes
6 answers

How do I run a .sh or .command file in Terminal

I've always wanted to be able to run a script I've downloaded online directly from the Finder but just double clicking the file does not work.
Maximus
  • 5,415
  • 3
  • 15
  • 18
162
votes
5 answers

Suppressing "The default interactive shell is now zsh" message in macOS Catalina

I know Catalina uses zsh as the default login shell and interactive shell, but it is very annoying when I open iTerm.app or run command with /bin/bash, it shows verbose message like below: $ /bin/bash The default interactive shell is now zsh. To…
Gasol Wu
  • 3,974
  • 3
  • 13
  • 12
147
votes
11 answers

How do I set environment variables on OS X?

I have always difficulties setting the Environment variables in OS X like JAVA_HOME, M2_HOME or PATH. How to set these on OS X Mavericks? I did some research but the answers I've found didn't really help me yet: export JAVA_HOME=/... (But it seems…
akcasoy
  • 1,699
  • 2
  • 14
  • 14
138
votes
3 answers

How can I list and edit all defined aliases in Terminal?

A friend who owned my current Mac before me created a lot of alias commands. Is there a way to list all defined aliases and the command that is associated with them? And if so, am I able to edit them or should I just remove them using unalias and…
MattStacey
  • 1,577
  • 3
  • 11
  • 7
129
votes
7 answers

Update bash to version 4.0 on OSX

Is it possible to actually update bash to version 4.0 in OSX Yosemite? echo $BASH_VERSION 3.2.57(1)-release This article and this thread refer to the same question, but they install a new shell side-by-side with the old one. Is there a way to…
sluijs
  • 1,403
  • 2
  • 10
  • 8
124
votes
5 answers

Getting all files from a web page using curl

I would like to get all files from the web page below using curl: http://www.ime.usp.br/~coelho/mac0122-2013/ep2/esqueleto/ I tried: curl http://www.ime.usp.br/~coelho/mac0122-2013/ep2/esqueleto/ It returned a bunch of lines in the terminal, but…
Thi G.
  • 2,224
  • 4
  • 21
  • 20
104
votes
2 answers

Why doesn't Mac OS X source ~/.bashrc?

I found a lot of people figuring out why instruction similar to this : Put X to your ~/.bashrc and you can do Y don't work. It always turns out that Mac OS X's bash's startup files (or Mac's Bash itself) doesn't source ~/.bashrc file, either in…
Paul Brewczynski
  • 2,029
  • 4
  • 16
  • 20
96
votes
5 answers

Is bash in OSX case-insensitive?

Are bash commands on OSX case insensitive? I type "which TR" and it shows /usr/bin/TR, though there is no such binary there. Same thing for other binaries, when capitalized. Or is Terminal.app maybe doing this translation? How do I turn this off?
verboze
  • 1,118
  • 1
  • 8
  • 7
92
votes
4 answers

Is it safe to upgrade Bash via Homebrew?

I'm new to OS X. I'm running OS X Lion on a MacBook Pro. Is it safe to upgrade the bash shell using Homebrew: $ brew install bash If safe, how do I make it the default instance of the shell I run through Terminal? Thanks!
Rudy
  • 1,023
  • 1
  • 8
  • 5
90
votes
1 answer

How to remove an environment variable on OSX using bash

I'm running under Snow Leopard 10.6.8 and I recently added an environment variable which it seems to be messing my bash terminal (I guess). What I did is add the variable DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.2/lib to my .bash_profile file, which…
Carlos G
  • 1,011
  • 1
  • 7
  • 4
1
2 3
99 100