Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bash]

The default Unix shell used by Terminal in macOS

1
vote
1answer
41 views

bash $PS1 containing an emoj

This question is related to https://apple.stackexchange.com/a/357132/44531 I would like to have a space after the emoj 😱. I've tried in the script below but I'm getting two lines instead of the ...
0
votes
0answers
14 views

On Mac terminal keyboard key action macros?

I want to assign long commands in one key on Mac terminal. For example, I have assigned command php bin/magento under F13 key from "Terminal → Preference → Profiles → Basic → ...
0
votes
0answers
22 views

Add IP alias on macOS like on Ubuntu? [duplicate]

I want to add a second IP address on my Mac like on Ubuntu. On Ubuntu I use this: $ sudo ip addr add 192.168.1.12/24 dev eth0 On my Mac I used this: $ sudo ifconfig en0 alias 192.168.1.12/24 On ...
3
votes
1answer
33 views

Is it possible to fix the spacing when using “ls” with colored output?

This is the exact same issue found here: https://unix.stackexchange.com/questions/165154/changing-the-spacing-between-files-in-ls When you run the command ls -G or CLICOLOR=1; ls the spacing in the ...
2
votes
1answer
18 views

Set sshd to serve different shell based on `host`

I want my local sshd to serve different shell, based on the host. Example: ssh user@hostname1 -> get's bash ssh user@hostname2 -> get's fish Is it possible, and if so, how can it be done?
2
votes
1answer
63 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
37 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
51 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
21 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
34 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
42 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
51 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
29 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
17 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/...
3
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
54 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 ...
0
votes
0answers
44 views

Automator to remove all text before hyphen ( - )

I am 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
14 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 ...
1
vote
1answer
46 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
59 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
33 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
75 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
733 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 ...
1
vote
0answers
59 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
44 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
49 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
48 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
36 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
119 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
102 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
45 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 ...
0
votes
1answer
41 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
273 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
26 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
30 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
71 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
90 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.
0
votes
0answers
75 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
39 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
60 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
25 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
390 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
192 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
65 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
49 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
42 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
99 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
49 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
99 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
56 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 ...