Questions tagged [bash]
The Unix shell formerly used by Terminal in macOS until 10.15
1,523
questions
0
votes
3answers
62 views
Why is bash unavailable even though installed?
My goal is to run a script, where the shebang line causes bash to be used. Somehow running bash always runs zsh for me, even though I installed bash 5 using Homebrew and Mac (10.15) comes with bash 3.
...
1
vote
0answers
41 views
How to change multiple text file names? [closed]
soilbase.0.out.satur.00001.pfb
soilbase.0.out.satur.00002.pfb
soilbase.0.out.satur.00003.pfb
soilbase.0.out.satur.00004.pfb
soilbase.0.out.satur.00005.pfb
I have files like these and I need to rename ...
0
votes
1answer
41 views
Network services deleted via terminal reenabled after Restart
I have written a shell script to remove all services excluding ethernet. The aim is to remove these services and PPPoE entries so the end user only sees ethernet under Preferences > Networking.
...
1
vote
2answers
36 views
Clipboard and class issue when running AppleScript “do shell script…”
I have a simple bash command that I have tried to envoke from AppleScript but it makes a strange unicode substitution.
Example content of the clipboard:
# 6C (d1/s2): F 11-12 100 Fly (1:12.95Y)
The ...
0
votes
1answer
32 views
Question about root rights
I have a question about this post and it says that if you want to leave out the "sudo" in front of it, the following is described
how to run `hping` without `sudo`
sudo chown root:wheel /usr/...
1
vote
1answer
43 views
Hyphen is being replaced by $'\342\200\224…' in bash
I've created a bash script to start a network computer if it is sleeping, then start a streaming client. However, as the script executes the final command to run the streaming client, each cli option ...
0
votes
0answers
14 views
Script for compressing Files within Outlook
To prefice, I have no background in scripting whatsoever
I'm trying to create a script that goes into the directory for Outlook and compresses files that are taking up a lot of space.
I was able to ...
0
votes
0answers
27 views
How to make iTerm2 colorful?
I have been trying to get my iterm2 terminal colorful, but I am having very little success. I tried adding the following to my .bash_profile
# Set CLICOLOR if you want Ansi Colors in iTerm2
export ...
0
votes
1answer
26 views
Quick way to exit terminal login attempt
Bash login will usually give three attempts before giving back the prompt. Sometimes it will give many more - like today which were infinite. Using control-c didn't abort that process it just entered ...
0
votes
1answer
33 views
Adding shell script to $PATH is still not executing properly
I have a directory called projects and inside that directory are subdirectories called project1, project2, project3, and so forth.
My professor hands out a .sh file located in these numbered ...
0
votes
0answers
28 views
Open file in Numbers via terminal
I'm trying to open a file in Numbers via terminal. I found the suggested command here: How to open files via Terminal
So I tried:
open -a "Numbers" filepath/filename
And I get:
bash: open: ...
1
vote
1answer
35 views
For the life of me can't find where terminal alias's are stored
So I have been playing around with aliases in bash and it is easy enough to add them.
alias lsl="ls -l"
My question is, where are they stored? I am using the bash shell, so I looked in the ...
1
vote
1answer
32 views
AppleScript and shell script issue
I used to run a shell command with AppleScript for authentication to a radius server, this was running fine as I could specify a parameter for the password.
the shell process was updated and don't ...
3
votes
1answer
57 views
Script menu: how to reference user-path utilities (PATH / environment is missing)
Summary
How can I execute scripts from the system-wide Script menu with a normal environment? It seems the environment is not being setup at all.
Scripts that are run from the script menu can find and ...
1
vote
0answers
46 views
Running AppleScript via shell(bash/zsh) expands window to height of desktop. How can I make it fit?
I have a shell script in which I use osascript to display a prompt to the user for selection from a list. The problem here is, when the script is executed via shell, the osascript window size is ...
0
votes
0answers
15 views
Alt- key for bash under xterm
Equivalent to alt-. in terminal explains how to uses the Alt key in Terminal. Is there a similar solution for bash in xterm (without having to use Esc)?
0
votes
1answer
35 views
How to create behavior like the $HOME variable
I have grown to use the $HOME variable a lot. So if I type $HOME/ and hit TAB it will write out /Users/user/. If I do a partial $HOME/Down and hit TAB it will write out /Users/user/Downlaods. I ...
0
votes
1answer
40 views
Terminal command ls/cd not opening external usb drive
I have a usb drive that I can access via Finder and rStudio but I cannot open the drive via Terminal to analyze its contents. I can see the usb drive name when I enter cd /Volumes && ls but ...
0
votes
0answers
27 views
Error when trying to open PNG file with Preview from command line
I use a bash script to generate a PNG file. At the end the script opens the PNG file, but occasionally I get the following strange error message
LSOpenURLsWithRole() failed with error -600 for the ...
0
votes
1answer
42 views
How to make an Apple Script use its local directory?
I am trying to bundle a .jar executable into an application using the solution provided here: How to create a .app folder from an executable .jar?. I deduced that main.script inside Contents -> ...
1
vote
1answer
25 views
How do you open a specific folder in Finder without applescript?
Background
I've replaced Finder as the default folder-opening app by editing ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist:
<snip>
{
...
1
vote
1answer
88 views
Make a sound in zsh when a command is not found
How can I get zsh to play a sound when the command is not found?
Ex: I have the alias vpn to open my VPN from the terminal (zsh). If sometimes by mistake I type cpn instead of vpn, I get the following ...
0
votes
1answer
47 views
Terminal can't execute files In CWD
I stated having this behaviour recently when I tried executing my sh script via sh my_script.sh.
It was a simple script with some pyinstaller command.
Now, the issue that I'm having is that my ...
0
votes
0answers
34 views
How to run Applescript via bash from JAMF?
this apple script code works fine from the Script Editor app:
tell application "Finder" to delete ((POSIX file "/Applications/Symantec Solutions/Symantec Endpoint Protection.app") ...
2
votes
1answer
49 views
What is the actual difference between sh and bash?
Based on what I've read online, sh is essentially an alias for bash; running a shellscript with sh will behave the same as if it's run with bash.
In my experience this is not entirely true, as ...
0
votes
0answers
43 views
Multiple Desktops/Spaces: Assign specific application windows to a specific Space programmatically?
I have seen existing questions (Assign Application Windows to Different Spaces/Desktops, Spaces in Mavericks: apps do not remember their space, How to have certain *windows* start in different spaces ...
1
vote
1answer
25 views
LaunchAgents zip/tar not working in plist?
I created the plist for a 'custom' backup agent (via LaunchAgent). The (zip) program is called, but I keep getting a 'zip error: Nothing to do!' in my logs.
I assume it has something todo with ...
0
votes
0answers
29 views
Using Packages to install and run homebrew
Using Packages to create an installer. The app depends on a package from brew. I added a install.sh to the pre-installation scripts section that has this:
#!/bin/bash
/bin/bash -c "$(curl -fsSL ...
1
vote
1answer
27 views
Empty output when using some shell commands via AppleScript's “do shell script”
AppleScript allows you to run shell commands with do shell script. It's easy to assign a variable to an output of such command.
set theResult to do shell script "echo everything"
>> ...
2
votes
1answer
3k views
Big Sur switched to zsh terminal but still uses .bash_profile
I've upgraded to Big Sur and noticed my user was still using bash shell, so I changed Users ā Advanced Options ā Login shell to /bin/zsh and restarted.
The shell that starts appears to be zsh insofar ...
6
votes
1answer
199 views
Same file reappears on Relocate Items after each macOS update
The following file keeps reappearing after each macOS update:
/Users/Shared/Relocated\ Items/Configuration/private/etc/shells.system_default
Ages ago I modified the file /etc/shells to add the latest ...
0
votes
0answers
21 views
bash (and others) do not receive ^O [duplicate]
Under Terminal.app and iTerm2, the key combination ^O is not received by many terminal programs.
For example, /bin/bash does not receive ^O. Indeed, if /bin/bash could receive ^O, then ^V^O would ...
1
vote
1answer
157 views
crontab Operation not permitted - cron has full disk access
I have seen here various issues about the crontab 'Operation not permitted' issue for Mac OS, but I seem to have a more complex situation on my hands.
I have a bash file on the desktop, which I wanna ...
0
votes
0answers
20 views
How to allow accessibility permissions from command line [duplicate]
I can give accessibility permissions to some programs by going in System Preferences -> Security & Privacy -> Accessibility, and manually adding the programs one by one.
Is there a way to do ...
1
vote
1answer
50 views
Adding Environment Variables
I can't understand the 3rd line in these instructions, found here
Install dependency Ghostscript. On MacOSX: brew install ghostscript
Create a symbolic link if you want to run it everywhere in bash ...
1
vote
0answers
34 views
How to automount an external drive to hold ~/LIbrary[/Developer[/CoreSimulator]]
Xcode simulators as usual multiples and expands
turning ~/Library into a dumpster
now on 256gb drive there is no space to install xcode 14.2 and i;m thinking to resolve the issue extensively
buying an ...
2
votes
1answer
82 views
How can I script moving files up one directory level with Terminal (or BBEdit worksheet)
When exporting from Photos.app with settings that preserve the album & folder structure, every album folder contains dated folders for every date represented in that album, with the actual images ...
0
votes
1answer
74 views
How to create a script with Automator to watermark each PDF in a folder with a different watermark?
I am trying to create a script to watermark a group a PDF files in a folder, each PDF has to have a unique watermark.
All the PDFs are in one folder, all the watermarks are in .png located in another ...
1
vote
1answer
79 views
Creating an alias for Python in bash/zsh
I have often seen people recommending to setup an alias in one's .bash_profile or .zshrc along the lines of
alias python='python3'
This seems like a convenient idea, however, as far as I understand, ...
-3
votes
2answers
75 views
How to get rid of phantom directories /Volumes on a Mac? [closed]
I have a couple of different problems with ls /Volumes. 1st, I have an AppleScript that could mount only 10 of my 13 volumes. The 3 I could not mount were named Data 1, Data 2, and Data 3. I renamed ...
2
votes
1answer
195 views
What is the exact equivalent of this netsh wlan add filter Windows command for Mac?
I want to block all networks from my PC with admin access and make it so that the user cannot reverse the changes. I will use admin access to only white list certain networks that will be visible to ...
1
vote
1answer
35 views
How should paths in /etc/paths.d get added to $PATH?
None of the paths I have in the /etc/paths.d directory are being added to $PATH in any of the shells on my High Sierra system. Presumably thereās supposed to be something in some file that says to ...
0
votes
0answers
27 views
How to run C# using Sublime Text3 build system on macOS?
I'm trying to run C# on Sublime Text 3 using a build-system config on macOS (with Command + B key combination).
I've tried a few build systems:
{
"working_dir": "${folder:${...
1
vote
0answers
30 views
Centrify: install using script in macOS 10.15
We were used to install Centrify using a simple script launched from KACE:
sudo /usr/sbin/installer -pkg CentrifyDC-5.5.2-x86_64.pkg -target /
Starting from Catalina, it seems that the script ...
1
vote
0answers
45 views
How use 'expect' to runing 'openconnect VPN' in background?
I'm a newbie to write bash script,I was using macOS catalina, and
I write a bash script which use expect to run openconnect,
#!/usr/bin/expect
...
spawn sudo openconnect --user xxx --protocol=...
0
votes
0answers
12 views
lesspipe stopped colorizing
Recently, lesspipe (installed through brew) stopped colorizing output. I'm not sure what changed to make it so, as the problem seems to be with the output of file, and both file and lesspipe.sh were ...
1
vote
2answers
49 views
Cronjob macOS does not work if set with a bash external script
I'm trying to create a new cronjob which launches a script every time at startup. If I do cronjob -e and then I insert for example @reboot bash /Users/user/script.sh and then I save everything is fine:...
1
vote
1answer
52 views
“__git_ps1: command not found” from running “/usr/bin/env bash”
When I run $ /usr/bin/env bash (but not otherwise) I get the error: __git_ps1: command not found
I've tried updating ~/.git-prompt.sh and ~/git-completion.bash for the version of git that I'm using. I'...
2
votes
2answers
316 views
Using launchd to clear bash history?
Clarification: Am not looking to destroy history, am looking for means
to periodically purge it via launchd for security purposes
Have been using cat /dev/null > ~/.bash_history to clear bash ...
1
vote
1answer
29 views
Every time I start my terminal, I get “.zshrc:source:18: no such file or directory: /sourceme.sh”?
I've been trying to download some softwares. I've deleted those files, but now, I think my zsh file keeps wanting to source a file that's no longer there. Because of that, I get the following message ...