Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
1
answers
90
views
Bash script on macOS: prevent next command from running until GUI app exits
I'm trying to write a simple shell script for OS X 10.10, to install a list of applications for new Macs we're getting in. I just want to fire off each installer one at a time to install each application. I'm using a bash script, which works fine, except for some installs I'm just calling the GUI in...
I'm trying to write a simple shell script for OS X 10.10, to install a list of applications for new Macs we're getting in. I just want to fire off each installer one at a time to install each application. I'm using a bash script, which works fine, except for some installs I'm just calling the GUI installer and installing that way clicking Next, Next Next... because that particular app didn't install properly through the terminal. (which is fine)
My problem is, that when the script opens the GUI installer for App A, it will then keep running down the script opening the commands next in line. What I want is for the script to wait to run the next command for as long as that installer window is open for. Windows DOS works this way, where you can make a batch file and it won't execute the next line until the first install is completed. So I'm looking for similar behavior.
I've tried a couple of things from reading but none of them have worked. As you can see, the places where I've put the "wait" command is where I want to to wait for the GUI installer to finish.
#!/bin/bash
# Install Script for OS X BYOD Laptops
# Installing Office 2016
open /Volumes/USB30FD/packages/Microsoft_Office_2016_Volume_Installer.pkg
wait
# sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_Office_2016_Volume_Installer.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_AutoUpdate_3.2.0_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_Excel_15.15.0_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_OneNote_15.15.1_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_Outlook_15.15.0_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_PowerPoint_15.15.0_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_Word_15.15.0_Updater.pkg -target /
defaults write com.apple.dock persistent-apps -array-add 'tile-datafile-data_CFURLString/Applications/Microsoft Word.app_CFURLStringType0'
defaults write com.apple.dock persistent-apps -array-add 'tile-datafile-data_CFURLString/Applications/Microsoft Excel.app_CFURLStringType0'
defaults write com.apple.dock persistent-apps -array-add 'tile-datafile-data_CFURLString/Applications/Microsoft PowerPoint.app_CFURLStringType0'
defaults write com.apple.dock persistent-apps -array-add 'tile-datafile-data_CFURLString/Applications/Microsoft Outlook.app_CFURLStringType0'
killall -HUP Dock
# Install ShareFile\
sudo cp -r /Volumes/USB30FD/apps/ShareFile.app /Applications/
wait
open -a /Applications/ShareFile.app
wait
# Install Absolute Computrace
# sudo installer -verboseR -pkg /Volumes/USB30FD/packages/RPClient.pkg -target /
open /Volumes/USB30FD/packages/RPClient.pkg
wait
open /Volumes/USB30FD/Ctclient103319-304806/ctmweb.app
# Install Symantec Endpoint Protection
# Run the GUI installer instead: open /Volumes/USB30FD/apps/Additional\ Resources/SEP.mpkg
sudo installer -verboseR -pkg /Volumes/USB30FD/apps/Additional\ Resources/SEP.mpkg -target /
wait
/Library/Application\ Support/Symantec/LiveUpdate/LUTool
# Install Trend Disk Encryption
open /Volumes/USB30FD/packages/Trend\ Micro\ Full\ Disk\ Encryption.pkg
I'm pretty novice when it comes to shell scripts, so the simpler the better. Thanks!
Fish
(11 rep)
Nov 5, 2015, 10:44 PM
• Last activity: Apr 6, 2025, 09:39 AM
30
votes
4
answers
13667
views
Why df and Finder shows different available disk space?
In home directory, `df -h $HOME` shows Filesystem Size Used Avail Use% Mounted on /dev/disk1 231G 177G 54G 77% / But in finder [![enter image description here][1]][1] Any ideas? **EDIT** Attached `df -h` output /dev/disk1 231G 177G 54G 77% / # this is memory disk /dev/disk2 7.0G 677M 6.4G 10% /Users...
In home directory,
Any ideas?
**EDIT**
Attached
df -h $HOME
shows
Filesystem Size Used Avail Use% Mounted on
/dev/disk1 231G 177G 54G 77% /
But in finder

df -h
output
/dev/disk1 231G 177G 54G 77% /
# this is memory disk
/dev/disk2 7.0G 677M 6.4G 10% /Users/HOME/Library/Caches
# this is an encrypted dmg
/dev/disk3s2 9.3G 7.0G 2.3G 76% /Volumes/NOT_HOME
# this is a bindfs
/Volumes/NOT_HOME/xxxx 9.3G 7.0G 2.3G 76% /Users/HOME/Library/some-folder
daisy
(55777 rep)
Mar 3, 2017, 07:39 AM
• Last activity: Apr 12, 2024, 03:07 PM
2
votes
1
answers
791
views
Why does using touch, to create an empty file with no filetype, create various kinds of files?
On macOS I am running a shell script that uses `touch` to create an empty file without an extension. The files created using the same script randomly have different Kinds, i.e. "Document", "Unix executable", "TextEdit.app Document" with no apparent differences between them. No extended attributes ``...
On macOS I am running a shell script that uses
touch
to create an empty file without an extension. The files created using the same script randomly have different Kinds, i.e. "Document", "Unix executable", "TextEdit.app Document" with no apparent differences between them. No extended attributes
/usr/bin/touch /Volumes/SDrive/complete/.hashes/"${1}"___"${9}"
variables contain text...
example filename:
"NOVA.S48E14.Particles.Unknown.720p.WEB.h264___221a636b1f174def7a72d90a9c9d4e9af6aab6ee"
I am curious why an empty file with no extension would be interpreted to be anything other than Kind "Document" when created with the touch
command, and if there is a method to specify without using an extension?
I have not been able to test this on any other OS.
John
(149 rep)
Oct 21, 2021, 04:13 AM
• Last activity: Oct 21, 2021, 06:56 AM
1
votes
0
answers
87
views
Is there a setting in a Linux file manager to show copy progress the way Finder in macOS does?
I was looking for a convenient file manager to move a lot of files and folders on Linux and needed to see as much detail as possible. Unfortunately I had some problems too, with some errors (details at the end of [this answer][1]) and had to restart the copy process a few times while having difficul...
I was looking for a convenient file manager to move a lot of files and folders on Linux and needed to see as much detail as possible. Unfortunately I had some problems too, with some errors (details at the end of this answer ) and had to restart the copy process a few times while having difficulties in identifying which files and folders have already been copied and which have not.
As I had a Mac on hand, I tried that too and very conveniently was able to see within the output window in Finder which files or folders were already copied (normal font), which were in the list to be copied (grayed font), and, among these, which were in the process of being copied (progress bar).
Is there a file manager for Linux with similar features? I mean at least one of the two (a progress bar for each item under processing and a list of what is in the waiting list).

cipricus
(1779 rep)
Jan 7, 2021, 12:28 PM
• Last activity: Jan 7, 2021, 12:47 PM
4
votes
1
answers
6743
views
ls command does not show app files in Applications or Utilities folders, but Finder shows the apps (macOS Catalina)
When I use the "ls -a" command in the /Applications or /Applications/Utilities folders, the only app that shows up is Safari.app in the /Applications folder. However, when I open the same directories in Finder, all of the apps are there and I can launch them and get info and everything. On a differe...
When I use the "ls -a" command in the /Applications or /Applications/Utilities folders, the only app that shows up is Safari.app in the /Applications folder. However, when I open the same directories in Finder, all of the apps are there and I can launch them and get info and everything.
On a different machine this is not the case, and the ls command finds all of the apps.
I have already tried re-partitioning the boot ssd, wiping all data on the drive, and performing a clean install of MacOS, however the problem persists.
Even in the recovery mode the problem persists. I have verified with a different machine that four apps should appear in the Utilities folder while in recovery mode, however on this machine none do.
At this point I have run out of ideas. If there is an even more factory reset I can do, I'm down to try it.
The most confusing part is that the ls command fails to find the apps whereas terminal has no trouble.
If you want any more specific information let me know and I will try to respond quickly. I apologize if this is the wrong place for this question, but I have never resorted to posting a question before, but this problem has me completely stuck.
Thanks!
Steam Trains
(43 rep)
May 1, 2020, 06:01 PM
• Last activity: May 1, 2020, 07:06 PM
3
votes
2
answers
2139
views
Why does finder and terminal report different file sizes for files and folders?
Looking at a folder within Finder on macOS High Sierra, it is telling me that the size of the folder is 8.14GB, whereas running the command `du -hsx Pictures/` it is saying that the size of the folder is 7.6GB. Additionally, looking at the first couple of files in the folder, the size they are repor...
Looking at a folder within Finder on macOS High Sierra, it is telling me that the size of the folder is 8.14GB, whereas running the command
For 001.JPG, Finder is saying 1.9MB whereas ll is saying 1.8M.
For 002.JPG, Finder is saying 2MB whereas ll is saying 1.9M.
For 003.JPG, Finder is saying 2.1MB whereas ll is saying 2.0M.
For 004.JPG, Finder is saying 2MB whereas ll is saying 1.9M.
For 005.JPG, Finder is saying 2MB whereas ll is saying 1.9M.
and so on. Why is Finder and Terminal reporting different sizes for files?
du -hsx Pictures/
it is saying that the size of the folder is 7.6GB.
Additionally, looking at the first couple of files in the folder, the size they are reporting in the Finder is different to what the output of ls -lh | head
is saying.

For 002.JPG, Finder is saying 2MB whereas ll is saying 1.9M.
For 003.JPG, Finder is saying 2.1MB whereas ll is saying 2.0M.
For 004.JPG, Finder is saying 2MB whereas ll is saying 1.9M.
For 005.JPG, Finder is saying 2MB whereas ll is saying 1.9M.
and so on. Why is Finder and Terminal reporting different sizes for files?
Ben Dyson
(188 rep)
Dec 21, 2019, 02:34 PM
• Last activity: Dec 21, 2019, 07:32 PM
1
votes
1
answers
75
views
Get path of currently marked file
Im running OS X and I'm wondering if there is a way to get the path of the currently marked file in Finder. Like, can UNIX determine what file i have clicked on? Reasons for this would be for example, I could make a service that runs a shell script, so that when I right click a file, I can choose, "...
Im running OS X and I'm wondering if there is a way to get the path of the currently marked file in Finder.
Like, can UNIX determine what file i have clicked on?
Reasons for this would be for example, I could make a service that runs a shell script, so that when I right click a file, I can choose, "Create Symlink" or something similar.
ln -s path/to/currently/marked/file path/to/currently/marked/file_symlink
And there could be loads of other stuff that you could do with this.
DisplayName
(12016 rep)
Oct 8, 2014, 02:30 PM
• Last activity: Oct 10, 2015, 06:19 PM
Showing page 1 of 7 total questions