Questions tagged [bash]

The Unix shell formerly used by Terminal in macOS until 10.15

Filter by
Sorted by
Tagged with
1
vote
5answers
331 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
45 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
34 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
44 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
46 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
26 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
19 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
36 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 ...
0
votes
1answer
35 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)-...
1
vote
1answer
21 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
26 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
23 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
32 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
230 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
10 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
36 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
108 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
16 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 ...
0
votes
1answer
32 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
26 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
28 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
378 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
94 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 ...
0
votes
1answer
216 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
73 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 ...
0
votes
0answers
46 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
83 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. ...
0
votes
0answers
12 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
33 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
43 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
14 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
30 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
34 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
26 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
67 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
20 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
51 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 ...
0
votes
0answers
37 views

Obtain Full Path of Copied File from Finder (Without special copy command)

When copying a file in Finder (Command + C) and pasting it (Command + V) in iTerm2 or Terminal the full path of the file gets pasted. I wanted to use this in a script by calling pbpaste but this only ...
0
votes
0answers
25 views

Add Finder Sidebar Section via Terminal

Is it possible to add a new section to the Finder sidebar? I'm interested in adding a new section to the Finder sidebar, and auto-populating it as part of some personal automation. I understand that ...
0
votes
1answer
28 views

Safe way to get “rm dir -rf” working (place options after dir name like on linux)

I don't know how many times I've done it. I'll type in rm dir and then have to move the cursor back and add in -rf to the command. Probably 10,000. In linux, I can just add the options in after the ...
0
votes
0answers
37 views

launchd running php script fails under Catalina on exec diskutil

I have a php script that worked perfectly under Mojave from the terminal and as a launchd job. After changing to Catalina, the php script continues fine from the terminal, but the launchd job fails on ...
0
votes
0answers
67 views

I can't reinstall my OS X El Capitan. “Please Run Install OS X El Capitan.app”

I'm in recovery mode, but when I try to reinstall the OS this shows to me. I've entry to the terminal of Recovery OS. And I found that file .app In other forum I found that the solution is move that ...
0
votes
1answer
33 views

Trying to add cronjob results in “”LICENSE“:0: bad minute”

I am trying to set up a cronjob to run every minute with the following command: crontab * * * * * sh /Users/username/Downloads/reddit-notifications-master/notifyer.sh notifyer.sh has the following ...
0
votes
1answer
15 views

iTerm unresponsive as xcode attempts (and fails) compiling every startup

Very recently, iTerm has become unresponsive for me when I open new instances of it. Whenever I open a new window or tab of iTerm, Xcode seems to be attempting to recompile a slightly older version of ...
0
votes
0answers
20 views

MacBook Pro 2011 Single-user mode hangs

I have a MacBook Pro 2011 with known GPU-problem and MacOS High Sierra on board. 3 years ago I solved this problem with this tutorial: link So I need terminal to enter commands, but I can't enter ...
0
votes
0answers
25 views

Why do my environment variables keep getting wiped out in Mac OS Catalina?

I am currently using MacOS Catalina, and every time my computer boots up from having shut down the environment variables get wiped out. I literally have to manually run export FOO=bar each time my ...
0
votes
2answers
39 views

Can't launch Finder window from terminal on Mojave

open isn't behaving as expected on Mojave. Running open /Library/ gives LSOpenURLsWithRole() failed with error -600 for the file /Library. This happens regardless of the opening location. I'm ...
0
votes
1answer
46 views

Catalina's zsh and its .zshrc file

I am trying hard to wrap my head around zsh "upgrade" from bash in macOS Catalina. Most of the things are great, actually. However, I cannot figure out why I am experiencing difficulties, like ...
0
votes
1answer
36 views

Merge audio and video in a monitored folder

I want to create a script on mac that monitors a folder and merge the video and the audio. But if file01 exists (previous merge file) I want it to create file02 and if this one exists I want it to ...
0
votes
1answer
27 views

How to save text to speech as a voice recording?

say "Hello World" is pretty neato, but it requires the terminal to stay open. Is there a nice way to save the recording from what a "say" would output as a file?

1
2 3 4 5
29