0
votes
1answer
29 views

Writing a Bash script to run and end at specific times

I'd like to create a script that will do the following. Start at a given time during the day and end at another given time. So for example, I have a program I'd like to test, so my script would be ...
8
votes
3answers
373 views

Creating a Bash script that will execute a program and if it exits without crashing, will run it again

I'd like to know the easiest way of creating a bash script that will run an app in MacOSX (it's a UNIX based system so I assumed this was the right place). wait for the program to exit. If the exit ...
2
votes
2answers
44 views

How to format textutil -excludedelements

I use Geektool on the Mac to display various information on my desktop. One feature of Geektoool is the ability to use shell mode to launch custom scripts or commands. I am not versed in any type of ...
0
votes
0answers
33 views

How to find the currently running app from terminal on OS X?

I'm writing a shell script runs in the background and monitors user activity. I'd like to be able to capture current application/document if possible. Can I do that? (Cross-posting this from ...
1
vote
1answer
48 views

Automatically copy PDF.plugin to Chromium.app

I'm using Chromatic.app to update my Chromium.app recently. I'd like to use Chrome.app's PDF.plugin in Chromium.app. Therefore I need to copy PDF.plugin to the following directory: ...
4
votes
2answers
128 views

run perl script with unknown perl location

I'm developing a perl script which expected to be downloaded by Mac users with a very small knowledge of shell, linux etc, let's say office managers and accountants. After the downloading the script ...
0
votes
1answer
86 views

How to write a script that will open up multiple tabs in the terminal?

I am on OSX and using iTerm I have this so far #!/bin/sh open /Applications/iTerm.app & exit 0 So after opening, I need two windows and one of those windows will need to open 6 tabs. two of ...
1
vote
2answers
57 views

Shell script not working to open LimeChat through the terminal

I created a shell script that I will execute in the morning to open up all the apps that I want startup.sh #!/bin/sh open /Applications/Firefox.app & open /Applications/Messages.app & open ...
0
votes
1answer
33 views

How to create an alias for opening a directory on Mac

Trying to create an alias hello. After typing hello in Terminal, then vi opens hello_folder. Now, this code returns: $ hello -bash: hello: command not found 1 #!/bin/bash 2 cd ~/Documents/ ...
2
votes
2answers
70 views

OS X: how to keep the computer from sleeping during a http connection

An application I use downloads data from a specific server, and I need it to sleep after the download has finished and the socket is closed. However downloads take place at random days, the app that ...
3
votes
4answers
198 views

Show video files with its size

I need all the .mp4 files' dimensions to be printed with the file name. For example: 1_VIDEO.mp4 1204x680
5
votes
2answers
243 views

Prevent a file from being deleted even after rm -f

I usually stay on StackOverflow but I think on this topic you guys are much more experts here. So today's exercise is weird, I have to write a script.sh and in it do whatever I can to prevent ...
1
vote
1answer
231 views

Bash script to hide/show files

I prepared a little bash script to toggle the visibility of my hidden OS X files. if (defaults write com.apple.finder AppleShowAllFiles FALSE); then defaults write com.apple.finder ...
14
votes
5answers
1k views

Bash in Linux v.s Mac OS

I am buying an iMac. I've been working on Linux for a long time and I do a bunch of bash scripting. I was wondering if all the bash commands and features are available on Mac OS ? Anyone has any ...
0
votes
1answer
196 views

MAC bash commands stop working properly

I was trying to install some stuff for scala development on my MAC, and probably I managed broke the shell/terminal while I was mindlessly running some scripts that I don't know. Now when I start the ...
3
votes
2answers
195 views

Make copies of a single directory to multiple directories with different names

I'm trying to replicate a single directory (with sub-directories) to a bunch of new directories based on a list. For example I can: mkdir Fred Barney Thelma Louise Foo Bar How would I copy a premade ...
2
votes
2answers
360 views

Am I using bash after this ordeal?

On Mountain Lion, host Coguaro, I login as user coconutpowder using bash: Coguaro:~ coconutpowder$ echo $0 -bash I need to run a command with elevated privileges so I try to su switch to root but ...
4
votes
4answers
4k views

How can I check if mysql is installed using a bash script?

I need to check if mysql is installed from within a bash script. What would be an efficient way of doing that? I thought I could do this: if [ ! -f `which mysql` ] ; then echo "foo" fi But I ...
10
votes
3answers
2k views

Fix or alternative for mktemp in OS X

I'm looking at a bash script someone else wrote that uses mktemp: TEMP=`mktemp --directory` However, this line does not work on my machine (OS X 10.6). How would I fix this line so that it is ...
4
votes
3answers
246 views

Best way to work through / display a tree of images sorted by size

I've got a deep directory tree containing .PNG files. I'd like to find all the .PNG files in the directory, sort them in order of size from smallest to largest, and then display every 50th image. ...