Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
0
votes
0answers
48 views

Cannot backup Documents folder using LaunchAgent and bash

I use the open source borg backup tool to make a daily backup of my Documents folder which is also on iCloud drive. I use a LaunchAgent stored in my local library directory to execute a bash script ...
6
votes
2answers
710 views

$PATH vs. $path

I can't remember why, but a long time ago, I found that for some reason, I needed to set both of these variables. It caused no problems in bash, but now in zsh, when I put export PATH=~/bin:/opt/...
1
vote
1answer
137 views

cp from shell (Terminal) or Finder: “Operation not supported”

An odd issue here after an upgrade from High Sierra to Catalina. When I try to copy files from an SMB network share in the Terminal (bash and zsh), I get: $ cp /Volumes/share_name/path/file.ext ~/...
1
vote
1answer
31 views

Finder shows executable shell scripts as Unix binaries

I am writing and using many shell scripts (bash) on my mac. One issue has been bugging me for a while. When I look at the scripts in the Finder, they come up as "Unix Binaries". If I tag a ...
0
votes
2answers
45 views

A better usage of apropos for searching the man directory

I will ask my question starting from a real example. From the command line prompt, I want to search for a command line tool that will output information about my smart card. Side Note: I already know ...
1
vote
1answer
51 views

Any other Terminal / shell based options to strip all ACLs and extended attributes from a folder?

I'm having some trouble deleting some folders that contain nothing and have no processes or kexts utilizing them (lsof | grep path_element). When I try to delete them (as root) I get: root@hostname /#...
1
vote
0answers
32 views

How to write to iCloud in Terminal? (Currently seems read-only)

I have a bash function that writes to a markdown file. Here it is in its simplest form: function n() { echo $@ >> path/file.md; } This works fine. However, when I change the path to an ...
0
votes
0answers
29 views

How to disable special history editing on bash command line [duplicate]

The letter g at the end of a path entry in either Terminal or iTerm2 is being captured and processed - I think by bash. Here is what typing cd /git/ciderg looks like: Notice the g is not typed. If ...
2
votes
1answer
590 views

How can I set oh my zsh to be my default shell?

I'm using Hyper as my terminal application and I just installed Oh My Zsh via curl. I'd like it to be my default shell environment but for some reason whenever I restart Hyper I have to run the zsh ...
1
vote
1answer
47 views

How to execute this brew installed tool 'gigtools'

My goal is to to run this 'gigtools' folder which extracts and converts .gig [audio] files into .wav files. Website: https://command-not-found.com/gigextract So I've installed the commands with Xcode- ...
1
vote
0answers
46 views

Automatically run script on login (MacOS 10.15)

Because of a small disk I've got an external USB-C SSD drive where I want to move some software projects I'm currently no working on. To see the outsourced projects in my default projects directory in ...
7
votes
1answer
2k views

Why does ls -a not show files that finder does show?

When navigating to /usr/local/bin a file called "R" can be seen: But when cd /usr/local/bin and ls (or ls -a), we see a long list of files, but no file called R: I was surprised by this - ...
2
votes
0answers
1k views

How can I determine the source of this permission message? “bash“ wants access to control “System Events“

I occasionally receive this permissions message in MacOS 10.15.5: “bash“ wants access to control “System Events“. Allowing control will provide access to documents and data in “System Events“, and to ...
1
vote
5answers
418 views

How to identify the largest files in a directory including in its subdirectories?

I have a directory with a lot of files and subdirectories. I know there are a small number of large files contained somewhere within. What is a quick/easy way to identify one or more large files in a ...
0
votes
1answer
68 views

Handling permissions to run a bash script

I'm sending a bash script as a .command file to a friend. This person is not very tech savvy which is why I'm sending it in the first place, the goal is for the .command file to run through the shell ...
3
votes
1answer
53 views

Where should I place local executables on macOS? [duplicate]

I often write system-wide scripts and I wonder where to place my executables on macOS. On many Linux system, /usr/local/bin (also /usr/local/sbin) is usually empty and I place my executables in there. ...
1
vote
2answers
63 views

grep ^\. not working as expected in Mac terminal

if I run the following command in my mac terminal: ls -al | grep ^\. or ls -al | grep '^\.' or ls -al | grep "^\." I get no results back even though there are several files in my home ...
1
vote
1answer
57 views

How to modify the command line text showing in Mac terminal

My Macbook Pro shows a wired string ("ryoitasuou") at terminal like below picture. Does any know how to remove or modify it ? I already deleted the "ryoitasuou" folder in /Users ...
0
votes
1answer
29 views

Successfully launching a shell script from Finder when the path has a space in it

Been trying to work this out this morning and beginning to wonder if this is even possible. When launching a shell script through Finder, either by using the extension .command or opening .sh files in ...
0
votes
1answer
27 views

How to compress multiple folders into multiple zip files

My folder structure is: YEAR - MONTH - DAY - SUBFOLDERS I want to compress each subfolder in the [DAY] directories. The solution from here which is: for i in */; do zip -r "${i%/}.zip" &...
0
votes
1answer
103 views

iTerm2, zsh and .zshhistory - how to have separate zsh history

I installed iTerm2 on Catalina 10.15.6 on a MacBook Pro bought in early 2020 and have two profiles - Default and MyUser. For MyUser, I set a custom location of /Users/john-doe/iTerm2/zsh (copy of zsh ...
1
vote
1answer
53 views

bash does not honor ~/.inputrc

under the latest macos $ sw_vers ProductName: Mac OS X ProductVersion: 10.15.6 BuildVersion: 19G73 i am using the latest bash (installed via brew) $ $SHELL --version GNU bash, version 5.0.18(1)-...
2
votes
1answer
26 views

How do I detect if headphones are connected (via the jack) in bash?

I have a script, and I want it to behave differently if headphones are connected. How can I get this information? I tried using SwitchAudioSource, but its output is the same, whether or not the ...
1
vote
0answers
31 views

Can't print remotely with “lpr” command unless I log in to remote Mac

I have remote access to a Mac and I'm trying to print over command line using lpr. However, the command is stuck until I log in to the remote Mac and press an icon to confirm the password already ...
0
votes
0answers
25 views

Know when a file is created (or saved) using bash

I would like to know if there is a command line program that can tell me when a file is created or saved. Suppose I am at ~/Desktop and I want to do something, for example run my_script, when I save (...
0
votes
2answers
67 views

What is the 'xmessage' command equivalent on macOS?

For Linux, there is a command xmessage which displays a message in a window. Does anyone know what is the equivalent one on macOS?
2
votes
2answers
267 views

syntax error near unexpected token `('

I was given a script to automate some processes. This script gets executed on a Mac in Terminal. The script is a bash script. However, Terminal is showing syntax error near unexpected token `(' in ...
0
votes
1answer
32 views

How can I get SnailSvn to run a custom diff command?

How can I make SnailSvn use vimdiff or any custom diff script? It only has a predefined list of options. To setup its diff support (for opendiff aka FileMerge), it asks you to copy the following ...
1
vote
1answer
41 views

Launching commands in separate windows using bash

How can I launch commands in new terminal windows? I've tried the below #!/bin/bash open -a Terminal "" -e "/usr/local/bin/zookeeper-server-start /usr/local/etc/kafka/zookeeper....
2
votes
1answer
118 views

Best Practice for User Shell Scripts location and/or PATH

I am interested in knowing if there is a best practice for placing/storing custom shell (Bash/Zsh) scripts and it's related PATH location. I know folks have their favorite places - I usually dumped ...
0
votes
1answer
31 views

Proliferation of unknown bash processes when invoking ps

I'm having some very strange behavior in my shell that I don't even begin to understand. I apologize for being somewhat lost, but I can't seem to turn up many obvious answers in a web search. I'm ...
1
vote
1answer
91 views

Config Profile ~/.bash and ~/.bash_profile Default & Preferred Permissions?

On MacOS, what are the default and preferred permissions for ~/.bash and ~/.bash_profile config profiles? This guide shows 700 as preferred. To view permission for a file: private stat -f "%Lp %N&...
0
votes
1answer
27 views

My shell prompt changed … without prompting

I'm still running bash on MacOS Catalina 10.15.5 (19F101). Sorry. Recently, I don't know why, the prompt in my bash sessions is acting up. There appears at the start of every prompt the string (base): ...
0
votes
1answer
47 views

Folder name containing “..” on ExFAT: How to rename it? Invisible to ls/mv/Finder but visible to tar/bash

On an ExFAT disk, I have a folder that makes tar fail: $ ls -a . .. paysages scenes de rue $ tar cf /tmp/f.tar . tar: ./fruits, legumes,..: Cannot stat: No such file or directory tar:...
3
votes
1answer
469 views

Create multiple files with different extensions with one command

I am looking for a way to create multiple files with one command and automate the process. They should share a common name but different extensions. The extensions are always the same. For example ...
1
vote
1answer
107 views

Terminal “history” command brings back different results

In OSX's terminal, I run the history command to find my recent commands. Often I notice recent commands will not show up, seemingly randomly. For example, I will log on one-day and notice my commands ...
2
votes
1answer
5k views

macOS Big Sur and bash

In Catalina, Apple made ZSH the default shell, however, macOS retained the (now deprecated) Bash. Despite my attempts to unearth something related to this, I couldn't find out whether Big Sur will ...
4
votes
1answer
79 views

Cryptographic Integrity and Authentication Validation of Homebrew Installer?

Is there a way to install homebrew on MacOS such that anything downloaded from the Internet is cryptographically validated for integrity and authenticated to the actual publisher? Unfortunately, the ...
1
vote
0answers
56 views

Why is Apple changing the default shell to zsh? [duplicate]

As bash is so broadly available, it provides a good compatibility layer for users that come from other Posix systems to use macOS. Why the move to zsh as the default shell, and why the extensive ...
1
vote
2answers
149 views

Want launchd to run a script weekly, but it is running it daily instead

I wanted to write a simple launchd job that runs a script every Monday morning at 7:00 am. The goal is to pull an image from tapmusic.net that catalogs my last.fm listening habits from the prior week. ...
1
vote
0answers
29 views

Terminal shows “active process” as “-zsh ▸ -zsh”

I have configured Terminal.app to show the "active process" in the tab title. When I open a new Terminal tab, it shows the corresponding field as "-zsh ▸ -zsh" rather than just "zsh" by default: My ...
0
votes
1answer
37 views

Get per-core CPU usage in terminal in machine-readable format

I need CPU utilization for each core. I want text-based output in the terminal. htop technically contains the information I need, but the output is not suitable for my use case as I need to pipe the ...
2
votes
1answer
54 views

Bash terminal windows and tabs take a few seconds to start

The problem appeared after using the Migration Assistant. Edit: There is no command in Preferences>Profiles>Shell. Both .profile and .bashrc are empty. Putting set -x at the beginning didn't help me ...
0
votes
0answers
41 views

Bash Command to Export System-Roots Certificates in Mac

I am trying to write a script to export all the system-roots-certificates from Keychain Access -> System Roots -> Certificates to a path as cert.pem file. When i tried the below command it did not ...
0
votes
0answers
54 views

How to set CUPS user in Catalina

Some background info: I am managing a CUPS printserver with printqueues for all the user accessible printers. The macOS clients get their printqueue set up as IPP via script. Once the printjob has ...
0
votes
0answers
116 views

How to use variable in alias termux?

my alias for opening Google is is like this alias g="termux-open-url https://google.com" for search url look like this http://google.com/search?q=what+I+search I wanted that if I write g what I ...
1
vote
1answer
33 views

How to get (logical) screen size from a shell script?

Using system_profiler SPDisplaysDataType, I can retrieve the size of a Mac's display in pixels. However, the command tell application "System Events" to get the size of every window of every process ...
0
votes
1answer
82 views

Run script at sunrise time

I'm trying to set my hackintosh pc to turn on at every sunrise and to run iTunes as the macOS boots up using bash or AppleScript without 3rd-party apps. I reached the point in my script when I need ...
0
votes
0answers
23 views

Run long running command in Terminal tabs using commands

From a .command file, I want to write steps so that multiple terminal tabs are opened and in each of those tabs a long running command is run and then my .command file should complete without stopping ...
1
vote
2answers
53 views

Change the shell that functions use

In my current terminal setup, I make use of zsh; it's my default shell. I also have an up-to-date version of Bash for other reasons installed from Homebrew. However, there is also the Bash provided ...

1
2
3 4 5
31