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

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
41 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
1answer
22 views

How to get rid of bash 4.1$? [on hold]

I am trying to load abaqus through exceed on demand. The terminal is now showing bash 4.1$ which was not the case previously. I used to give the same commands as I have given here previously and could ...
0
votes
0answers
31 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
7 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
44 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
0answers
45 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
28 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
61 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
714 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
49 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
41 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
43 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
46 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
79 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
97 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
37 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
votes
1answer
30 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
208 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
23 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
28 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
65 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
58 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
41 views

Terminal host and user now showing

terminal output \W $ I was trying to change the hostname and due to some error in the command, my terminal got messed up.
0
votes
0answers
45 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
58 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
24 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
389 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
105 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
58 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
48 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
41 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
93 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 ...
2
votes
0answers
26 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
97 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
55 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
36 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
34 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
31 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 ...
2
votes
0answers
34 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 ...
0
votes
0answers
24 views

Viewing a terminal script as it runs in Automator

I have written an Automator Service that calls ffmpeg, encodes the selected files in Finder, then sends a notification via Growl to Prowl on iOS. It all works, but I'd like to be able to view the ...
0
votes
1answer
45 views

Command line to create a PDF document from a batch of images [duplicate]

How to create a PDF document from a batch of images ? === Belowis what I tried before posting this question: The ImageMagick way, but the PDF document generated is too big: convert *.ppm book.pdf ...
2
votes
2answers
105 views

Why aren't my profile and bashrc files hidden?

I've been following tutorials to edit .profile, .bashrc and .bash_profile and I discovered that my computer has profile, bashrc and .bash_profile files instead. i.e. Only the .bash_profile file is ...
1
vote
1answer
129 views

In a MacOS Mojave bash script “-w /etc/passwd” is false even for root

An old bash script I have tested to see if a user was root by seeing if /etc/passwd was writeable. In MacOS High Sierra it returned true for root, and false for anyone else. But in macOS Mojave the ...
3
votes
3answers
132 views

Is there any way to convert a bunch of .ogg files in a folder to .mp3 using ffmpeg?

Is there any way to convert a whole heap of .ogg files in about 30 folders in a folder containing those folders to .mp3 files and put them in another folder using the command ffmpeg? The previous ...
1
vote
1answer
185 views

Use 'mv' command to move files except those in a specific directory

In Linux, I know the command mv !(folder1|folder2) folder1 if I want to move all files in current folder, excepted folder1 and folder2, and move they in folder1. But these commend, doesn't work in mac ...
1
vote
2answers
76 views

ls -axi (what does it do)?

So I was messing around in terminal, and when i opened it, I typed cd applications . Nothing bad here. Then, I typed ls -a\ in applications (or maybe /, I don't know, but it opened the > thing ...