Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
6
votes
3answers
2k views

Now that MacOS Catalina has moved to zsh, can I upgrade bash 3.2.57 with 5.0.3?

I understand apple's move from bash to zsh, though I'd really rather that they hadn't made the change. I've tried zsh, and decided that I'd prefer to remain with bash. So, since MacOS Catalina isn't ...
0
votes
2answers
103 views

Automator Change to directory of dropped files before running Shell command

Seems extremely simple, but I can't figure it out... I want to be able to change to the directory (folder) where the dropped file is located before running my shell script on that file. So either I ...
1
vote
1answer
2k views

'ls' command not working on mac OS Catalina

Ever since updating my mac to OS Catalina I have noticed quite a few changes were made to the terminal. Upon opening the terminal there is always the entry: The default interactive shell is now zsh....
0
votes
1answer
57 views

Keep standalone bash script app open after run of script

I have a bash script that I have turned into a standalone macOS app (i.e. I created a folder Script.app which contains subfolders Contents and MacOS and in the folder MacOS resides my bash script). If ...
1
vote
0answers
22 views

using breakpath command in shell file

From somewhere I have available in the macOS 10.15.1 Terminal window the command "breakpath", which gives as output the entries in $PATH, one per line. And I can redirect its output, e.g.: breakpath &...
1
vote
1answer
31 views

Shell variables in standalone app of bash script

I have a bash script that mounts a fuse filesystem created with the backup tool borg. Mounting the filesystem requires a passphrase. The mount command of borg allows to read the passphrase from an ...
3
votes
1answer
236 views

Path into PS1 prompt is broken (\n) on different lines when it is too long

I am using iTerm2 on MacOS Catalina . Here is my PS1 into ~/.bashrc , using a function ps1 : function ps1 { # PROMPT SECTION BLUE='\[\033[0;34m\]' LIGHT_CYAN='\[\033[1;36m\]' ...
2
votes
0answers
205 views

macOS Terminal not using correct manpath

How to set $MANPATH or manpath for the macOS Terminal Help menu command: Open man Page for Selection? Having recently done a clean install of macOS Mojave (10.14.6), I am trying to get my macOS ...
0
votes
1answer
175 views

Basic 'print' & 'puts' Mac OS terminal commands not found

I followed this article to install & update ruby with a package manager but I clearly messed up somewhere. https://stackify.com/install-ruby-on-your-mac-everything-you-need-to-get-going/ If I ...
0
votes
1answer
45 views

Copying all files of specific type to a specific folder using Mac's Terminal

How can I copy all files of specific type to a specific folder using Mac's Terminal. find . -name '*.STY' -type f -print0 | xargs -0 -I '{}' /usr/bin/rsync -avR "{}" "./styleFiles_chekad/" Above ...
1
vote
1answer
153 views

macOS catalina ignores shell in AD and uses zsh instead

We have Catalina hosts connected to our AD domain. Directory Utility shows AD users having /bin/bash as their shell (in Directory Editor), and the default shell for the domain is /bin/bash (in ...
1
vote
1answer
250 views

MacOS - Where is Terminal themes/profiles utilized by Terminal.app on disk?

I know i can export a profile, i can then use it, but if I modify it, i have to export it again, to have a proper backup. I'd rather have a symlink to the actual file in use by terminal rather than ...
2
votes
2answers
2k views

Enabling /bin/bash on Catalina - invisible to System Preferences -> Security & Privacy -> Full Disk Access

I am having trouble enabling /bin/bash on Catalina - Macos 10.15.1 When I try to enable it using "System Preferences -> Security & Privacy -> Full Disk Access", the pop-up finder list doesn't ...
1
vote
1answer
415 views

How to get rid of (base) inside terminal app in 10.14.6?

when I get a fresh terminal, my prompt says (base) ~> The (base) part is something that seems new. Was this added during a recent update? How do I get rid of it? There is one piece of ...
1
vote
1answer
47 views

My ifconfig: command not found for some reason

I'm using Mac Sierra version 10.13.6 and when I try using ifconfig it just outputs -bash: ifconfig: command not found And, when I run $PATH, I get: -bash: /usr/local/bin:/Library/Frameworks/Python....
1
vote
1answer
637 views

Can't use zsh shell in Catalina

When I opened Terminal after installing Catalina, this appeared: The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please ...
7
votes
4answers
942 views

How to prepend a character to start of each line in 250,000+ line file using a script?

I have text file with 250,000 lines - and I need to append the same single character at the start of each line. I have tried to use various multiline /column edit plugins in Atom and Sublime but they ...
0
votes
1answer
30 views

Unexpected behavior of bash script used to sync dotfiles

I'm using essentially this script for keeping my dotfiles under version control. I recently added a snippets folder inside my emacs.d directory and listed it as one of the things that should be ...
1
vote
1answer
35 views

Copy paste string to terminal leave a dangling empty area appearance

If you see the bell on the title, it means when I deleting string it was reaching $ sign and give a bell warns. But the strange thing is my cursor is not completely clear the string, it is still ...
0
votes
0answers
162 views

Running but not sourcing `~/.bash_profile` on file-write

I have an odd but no-longer-reproducible issue with iTerm2 and Bash. My default iTerm2 profile uses /usr/local/bin/bash (Bash 5 installed with Brew) with no arguments. I was trying to determine when ...
12
votes
2answers
4k views

:wq command not found

When opening terminal, this line shows every time: -bash: :wq: command not found How can I stop it from appearing every time Terminal opens ?
1
vote
1answer
110 views

com.apple.xyz.plist - replace value - not set key - possbile?

I've looked into using PlistBuddy and plutil but most examples such as: How do I replace a value in an plist array using plutil? seem to suggest setting the value of a key, which is not the case ...
3
votes
2answers
1k views

cron lacks permissions to run a script

I have a script (which backs up, using rclone) that I can run from the Terminal or Automator after chmod a+x, with no permissions problems. However, when this script is run in cron (or launchd), ...
3
votes
1answer
72 views

Terminal.app: changing shell behavior problem?

I'm having problems setting Terminal.app's default shell. It appears to work using a command line utility which sets the shell for the account, however not in Terminal.app's dialog which is for each ...
0
votes
1answer
488 views

Terminal won't find command of custom script since Catalina update

I have a very simple script to hide the icons from my desktop #!/usr/bin/env bash defaults write com.apple.finder CreateDesktop false killall Finder It is located in $USER/bin. Since the update, ...
1
vote
0answers
22 views

Bash-completion breaks hosts tab completion

Prior to installing Bash Completion, hitting the "tab" key after an "@" character would autocomplete hostnames listed in /etc/hosts. For example, if I started typing: drush @lo [tab] It would ...
0
votes
1answer
99 views

Unable to edit .bash_profile file on mac [duplicate]

Unable to edit ~/.bash_profile file on my mac. I did some changes in this file and rebooted. From then nothing is working on my command line: Any help would be appreciated.
0
votes
1answer
28 views

Command works when run from alias but not when typed?

I use to type this command a lot : sshfs 10.xxx.xx.4:/Users/username/code mountpoint So one day i put it as an alias on my .bash_profile as alias sshfs='sshfs 10.xxx.xx.4:/Users/username/code ...
2
votes
2answers
153 views

Resetting /usr/bin [closed]

So I was installing python3, pip, and a few other applications through Homebrew when I first got my Mac. I realized I was doing all this in /usr/bin and not /usr/local/bin, and I wanted to just to ...
7
votes
4answers
2k views

I switched to Catalina and enabled ZSH now my home/end key do not work in terminal

I switched to ZSH from BASH as per the upgrade in Catalina and all is well except my home/end keys no longer work. This can be really annoying trying to move my cursor over super far to the left ...
0
votes
2answers
123 views

list files by date added in terminal with function or script or another

I found this in another post but would like to be able to call a script of function to reduce the amount of typing. ls -a | \ grep -v '^\.$\|^\.\.$' | \ xargs -I {} mdls -name kMDItemFSName -name ...
2
votes
1answer
55 views

Effects of changing shell

Recently Apple changed the default shell to zsh from bash. In the past I made significant changes to my .bashrc file. How should I incorporate those changes into the zsh terminal?
5
votes
1answer
2k views

Easiest way to migrate aliases from bash to zsh

I want to start using zsh as recommended by Apple for Mac OS Catalina. How do I migrate my aliases that I have defined in the ~/.bash_profile to the new shell?
0
votes
1answer
64 views

bash variable with spaces why cd “$myvar” results in one parameter, but myvar='“some stuff”' in two? [duplicate]

I'm struggling to understand why following does not work as expected in bash: $ myvar='"some stuff"' $ echo $myvar "some stuff" $ cd $myvar bash: cd: "some: No such file or directory I know the ...
13
votes
2answers
38k views

How do I remove the source (base) from my terminal?

I created some new aliases in my .bashrc file and did source ~/.bashrc Now, everytime I open my terminal it always comes with the (base) How do I remove that?
2
votes
2answers
229 views

grc inside terminal (with different colors into terminal as a function of files size) not working on 10.14.6 Mojave and working on High Sierra 10.13.6

I can get working the tool grc which allows to have colors for permissions and different colors as a function of the size of files listed for example with ls -l command. On my previous MacBook with ...
1
vote
3answers
2k views

How to add the PATH for mysql bin on Mac?

I want to add the PATH for mysql.exe on my Mac. I tried this via terminal, but $ vi.bash_profile vi.bash_profile command not found. does not work. I tried this for generating the bash_profile to ...
1
vote
1answer
336 views

Is there a command to remove previously installed package?

I have installed a .pkg package with the installer command. But there are problem with that installation. Now I want to remove it. Is there a standard way to do it with command line interface? Note: ...
1
vote
1answer
43 views

Command line “open DIRNAME” fails (but “open FILENAME” is OK)

In a terminal (or xterm, or emacs) window, the command: open dirname (where dirname is . or /tmp or /home/fred) doesn't open the the specified directory in Finder. However: Opening a non-directory ...
1
vote
2answers
563 views

How to combine multiple pdf files based on location and name with command line?

I have multiple folders with this structure: Folder Name/ tmp Other Folder name/tmp and so on... Inside tmp folder I have many pdf files with this name pattern: pdf-name-1.pdf pdf-name-2.pdf .... ...
3
votes
1answer
190 views

MacOS terminal Hangs on `login`

On my macbook, I've found that sometimes it gets into a state where it cannot open up a new terminal - a blank terminal window just appears, and it hangs. Rebooting solves this, but it seems to ...
3
votes
2answers
102 views

How to create recursive download and rename bash script

I need to make a bash script that will download a image with curl and then rename the file, wait 5 mins and then re-download the file and rename it again so that the new file does not replace the old ...
4
votes
2answers
2k views

Why is wc -c printing spaces before the number?

command: echo "test" | wc -c results (7 leading spaces): " 5" I tested this on my linux box and I don't get the space in front of the five. is this a bug or expected behavior?
0
votes
0answers
75 views

Mac OS capture output from shell script that launches application

I have a .Net Core application that I'm running on a Mac. I am currently using a shell script to launch the executable which is working well however I am wondering where the output from the script is ...
1
vote
0answers
75 views

How to pass filename as an argument passed on launch?

I would like to pass the script's filename to the "Arguments Passed On Launch" found in the Scheme editor under "Run". I looked at this Xcode documentation but did not find an answer. Currently, I ...
5
votes
1answer
72 views

Bash: Elegant ways to use multiple variables for shortening long strings?

I am aware of dockutil in homebrew but, I am trying to run a bash script that automatically adds dock icons to the dock on a fresh user account. dockutil has been uncooperative on fresh out of the box ...
2
votes
1answer
24 views

ImageMagick complains when image is missing while stitching together tiles of an image

I have to stitch together pictures (first vertically, then horizontally) with a varying amount of tiles via the command line on macOS 10.14.5. I usually use this command: convert -append 0_0.jpeg 0_1....
1
vote
1answer
28 views

Merge two pdf to one with their pages merged alternatively [duplicate]

I have a PDF A.pdf and B.pdf and would like to merge them both to AB.pdf, where each page is merged alternately so that page 1 in AB.pdf would be the first page of A.pdf and page 2 in AB.pdf would be ...
1
vote
1answer
109 views

Why is my .ssh/config file not readable?

I am trying to edit my ssh/config file, but when I type emacs ~/.ssh/config into Terminal, it says that the file is not readable and will not save my edits. When I try to overwrite, it says permission ...
1
vote
1answer
32 views

Command line issues

I'm trying to execute two commands in a single line: pkill "something" && runsomething when executing each command separately, both work. When executed together with "&&", only the ...

1
3 4
5
6 7
31