Questions tagged [bash]

The default Unix shell used by Terminal in macOS

Filter by
Sorted by
Tagged with
2
votes
1answer
87 views

Terminal PATH startup message

I messed up when installing Cisco Packet Tracer for Linux and it some how changed a few bash files. After a few hours of looking around and changing my PATH, when I open a new Terminal window I get a ...
2
votes
1answer
50 views

How can I make sure that the title of a Terminal tab/window is identical to the command I typed

I noticed that for aliases etc the title of a Terminal tab/window often isn't the same as the command I typed. This is sometimes confusing, especially for long-running processes with similar names. ...
0
votes
1answer
99 views

Why does chunkwm fail with “Permission denied” error for .chunkwmrc

ashleyharvey@Themis:~$ ls -al .chunkwmrc -rw------- 2 ashleyharvey staff 4.7K Apr 4 22:24 .chunkwmrc ashleyharvey@Themis:~$ chunkwm /bin/bash: /Users/ashleyharvey/.chunkwmrc: Permission denied So, ...
1
vote
1answer
34 views

LSCOLORS format

I want to configure my .bash_profile and I've seen this post about BSD based ls configuration: https://www.cyberciti.biz/faq/apple-mac-osx-terminal-color-ls-output-option/ I just don't know what is ...
1
vote
0answers
75 views

iTerm2 still opens old shell after Bash upgrade

I tried upgrading my MacOS Bash from 3.2 to the latest version as in this article. It involves installing the latest Bash with Homebrew and then setting the default shell with chsh. However, chsh ...
0
votes
1answer
60 views

Get parent of symbolic link instead of original folder

I have a project with node_modules folder that contains a symbolic link to another project. The problem that inner project takes configs from parent project (etc ../../../config) and thus cannot find ...
1
vote
3answers
117 views

osascript display dialog hangs when screen is off; detect unavailable GUI/display from bash or applescript?

background I've been working on a backup script that runs occasionally via launchd. When it runs, it prompts me with something like: osascript -e "display dialog \"Is now a good time to back up?\"" ...
4
votes
0answers
30 views

Is there a script/cmd that I can create/run that will allow me to install .dmg? [duplicate]

I have been working on a "Mac Rollout Project". After I run the Macs through the Apple setup, I have a list of .DMG / Applications that I have to install. There is no particular order that the .DMG / ...
0
votes
1answer
59 views

Failing to send Wake-On-LAN UDP packet with netcat

I'm trying send a WOL packet from a bash script under Mojave, much like https://stackoverflow.com/a/31588036/9370650, without any third-party utilities, such as the nifty https://github.com/jpoliv/...
4
votes
1answer
1k views

Why is .bash_history periodically wiped?

This is the second time it's happened. I just tried grep-ing some historical commands and came up empty. a look at my bash history shows that it's practically empty. Like it's been wiped clean. I use ...
3
votes
1answer
83 views

Extract numbers from string using shell

Using shell script, how do I extract two sets of numbers from a string like "R14C11"? I'd like to get the result as an AppleScript list. R14C11 -> {14, 11} R5C9 -> {5, 9} "R" and "C" will be ...
1
vote
1answer
82 views

Automator to remove all text before hyphen ( - )?

I'm trying to create an Apple Automator application that will rename a group of files by removing all text before and including a hyphen ( - ) that will post an error if trying to rename a file with ...
1
vote
1answer
47 views

How can I change the ownership of the unwritable directories for Homebrew?

I had admin account before and I deleted the admin and made the user as admin because it was bit of pain in neck. This is now the admin user called zuhairhallak. Before, installing Homebrew, it was ...
0
votes
1answer
59 views

Where in the file system is my shared folder? (AKA: Where is /Volume, and Why Can't I Open It in Finder?)

I want to run a bash script periodically to track the size of a shared drive on my network. The command that produces the data I want is du -sh. I have created a Login item to mount the shared drive ...
0
votes
1answer
78 views

How to remove special character from a folder name?

I am creating a folder like mkdir -p ../service/target/static but windows creates it with some special character static. I need to explicitely remove that special character using shell script. I ...
0
votes
1answer
60 views

Encrypt password with security command

I want to deploy smb password with ARD, or create a small script. With the command security I have the possibility to add a password in keychain without share the password. security add-internet-...
0
votes
2answers
159 views

How to get error status back to bash from osascript

Inside a bash script, I'm closing the front window of whatever application is foreground. I'd like to know if the command failed (when the foreground application doesn't have a front window. I tried ...
7
votes
2answers
747 views

Difference between two quite-similar Terminal commands

I have a script that I run as part of my development (it's the activation script for a Python venv environment). The way the documentation suggests that we run it is by going to the folder containing ...
2
votes
0answers
148 views

Bash autocomplete in Terminal stops working after a while

Bash allows auto-completion using the tab key: If you type cd ~/D on Terminal, followed by the Tab key, you ear a beep, but if you follow by a second Tab key, the Terminal display the suggestions ...
3
votes
1answer
47 views

Attach one .dmg file on different computers at the same time (hdiutil attach)

I have a question about "hdiutil attach" I've "created" (ctrl+c/ctrl+v) one bash script to execute some .app automatically. First im mounting shared folder: mount_smbfs -o nobrowse //SERVER/share "...
2
votes
2answers
109 views

How to show current time in mac terminal prompt?

I have this: PS1+="\D{%H:%M:%S}"; But this displays the time the prompt started. I want the prompt to show the current 12 hour (not 24 hours) time live (so it keeps changing, and then when a command ...
0
votes
0answers
50 views

Create variable size columns from tab deleminated file

I would like to columnize data from excel. I need to paste the data in a simple text file. Tabs need to be replaced with blanks. What I need is to be able to select the column width.How cat ...
0
votes
0answers
39 views

Is it possible to duplicate and rename an application?

I tried to do this: ➜/Applications$ cp -R Atom.app OtherAtom.app but opening OtherAtom just basically opens Atom. It does not produce another application in the command tab menu. Maybe I need to ...
0
votes
2answers
424 views

After uninstalling Oh-My-Zsh, my terminal is messed up

This is not a duplicate question. I've already looked at the answers for Uninstalled zsh, terminal gone weird, and although I changed the settings, it still defaults back to zsh title, with a ...
3
votes
2answers
128 views

How to update shell programs

How do I update shell programs like crontab for example? On my Mac I've got version from 29th of December 1993, but on a server linux machine that I am using version of crontab is much better in terms ...
1
vote
1answer
75 views

Weird LSCOLORS after copying files

Recently I've done clean reinstall of MacOS and naturally I copied all of my important files to external drive and copied them back once I had a clean installed system. The problem is when I type ls ...
1
vote
1answer
112 views

Proxy Authentication Error in pip install Mac

I have tried to set the proxy in the bash_profile: export http_proxy=http://UserID:PWD@202.141.80.24:3128 export https_proxy=http://UserID:PWD@202.141.80.24:3128 export ftp_proxy=http://UserID:PWD@...
4
votes
2answers
773 views

How can I fix my terminal when editing the PATH in .bash_profile has the startup hang and I get no prompt?

I am new to the command line and clearly messed up my setup. macOS High Sierra(10.13.6) Trying to set up Python and VScode. My path variable is what I believe is wrong, but Idon't know exactly how ...
1
vote
1answer
36 views

Terminal - lose useful keyboard shortcuts during SSH connection

I'm encountering an annoying issue. When I'm connecting to a Linux VM through my terminal by ssh, I don't have tab completion, or I can't navigate through my past commands with the directional arrows. ...
0
votes
1answer
40 views

Why does this shell-script dim my bash colors?

My ~/.bash_profile contains this: function rgb { # https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit let "sum = 16 + 36*$1 + 6*$2 + $3" # echo "\[\e[${sum}m\]" tput setaf ${sum} } ...
5
votes
1answer
94 views

How can I create a Finder alias in a bash script that reads arguments from the command-line?

I'd like to write a bash script that takes 2 inputs: path to actual file path of a Finder alias file (not a unix link) to be created that refers to 1. The bash script should pass these inputs to an ...
2
votes
2answers
236 views

How to open a app in fullscreen via terminal in bash code

I would like to know how you would be able to open a app of your choice in fullscreen by using bash code in terminal.
1
vote
1answer
199 views

Cannot configure xdebug; “Operation not permitted” error when trying to cp

I'm trying to configure xdebug, but when I run the command cp Downloads/xdebug-2.6.1/xdebug-2.6.1/modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20160303 I get a "Operation not ...
0
votes
1answer
40 views

Modifying `whatis` to return error code for missing commands

Followup to "whatis" returns 0 for missing commands, I am trying to modify /usr/bin/whatis to return a non-zero exit code after an inappropriate command has been entered. My approach to ...
0
votes
1answer
84 views

Different execution of bash script in 'execute shell script' action in Keyboard Maestro

I try to execute shell script using Keyboard Maestro. In macOS Terminal and Raspberry everything works good. KM shows a strange error. Looks like the script works but poorly recognizes characters or ...
1
vote
1answer
30 views

GUI trash different from terminal trash

On Mac OS X El Capitan (MacBook Pro Mid 2014) it seems that visiting the trash bin from the GUI produces a bunch of files however visiting .Trash user$ and running ls -a only produces a single file. ...
2
votes
1answer
391 views

Giving instructions to an executable in UNIX?

I'm pretty new at this, so excuse me if this is too easy. The thing is, I have a bunch of instructions stored in a text file named: 'FTIG_dldStruct.txt' and I want to write them all into an executable ...
1
vote
1answer
424 views

Automator: Move files into new subfolder based on file's name

Disclaimer, this may not be something Automator can do. I have a large directory of movie files. In order to use a piece of software, each movie needs to be in it's own folder. I'd like to create ...
1
vote
1answer
81 views

macOS - Bash commands not working as needs to be

First of all, the problems: I'm not able to use both exported bash commands and default system bash commands at the same time Some of the exported paths working on terminal but some of them not ...
1
vote
1answer
60 views

“whatis” returns 0 for missing commands

On macOS 10.14, using whatis on a command that is not installed prints 'command': nothing appropriate as is expected. But returns 0 instead of an error code, which I believe is expected behavior. It ...
1
vote
1answer
52 views

Error when parsing my .bashrc — sytax error: operand expected (error token is “ ”)

I have the following snippet in my .bashrc: # Returns system load as percentage, i.e., '40' rather than '0.40)'. function load() { local SYSLOAD=$(cut -d " " -f1 /proc/loadavg | tr -d '.') # ...
0
votes
0answers
122 views

Calculating sha256 returns also “-bash: <string> command not”

I'm trying to find a SHA256 hash of a string: $ fdsafdsa | shasum -a 256 While it returns a hash, it also throws an error: -bash: fdsafdsa: command not found ...
3
votes
1answer
96 views

What does “Cache location entry for Photos.app in cache file” error signify in Automator app?

I have written a very basic script to count the number of files in a folder, then if it reaches 16 files, to run an automator workflow, as below: #!/bin/bash cd /Users/barbooths/Projects/...
1
vote
1answer
108 views

Copy files from Folder A to Folder B based on Text File C with bash

How do I copy files from Folder A to Folder B based on Text File C with bash? folderA: source folder with image files only, e.g. image01.png, image02.png etc. There are no space in the image names, ...
1
vote
1answer
71 views

Determine com.apple.Finder AppleShowAllFiles status using command line?

Is there a way that I can grab the status of com.apple.Finder AppleShowAllFiles in command line? I switch between AppleShowAllFiles yes & no frequently, I want to write a .command file to check ...
0
votes
2answers
96 views

Hide the cursor from the terminal

I want to be able to hide the cursor programmatically. I am okay with giving any required permissions to the script.
0
votes
1answer
90 views

Script to check to see if certain applications were installed [closed]

I am very new to Macs however I did hear that there was a Bash script that can be utilized to check to see if certain applications were installed on a machine
9
votes
2answers
1k views

Can't run one particular program from Terminal without using its full path

I want to run a program ds9 from the Terminal. The program is clearly in the PATH, which I determined by running: which ds9 /Users/evgenii/miniconda3/envs/iraf/bin/ds9 But when I run the command by ...
0
votes
1answer
68 views

Removing Files after Successful Extraction unrar rm shopt globstar

shopt -s globstar for f in **/*.rar; do dir=`dirname "$f"`; unrar e "$f" "$dir" && rm -frv "${f::-2}*"; done From echoing out testing the rm command, the file is the correct path. I ...
1
vote
0answers
89 views

Change keyboard layout automatically when external keyboard connected

I recently purchased an external keyboard (non-apple) that is used at home and also dragged along with me from time to time, and I've noticed a need. My Mac is in English, as well as its physical ...