1
vote
1answer
60 views

command not found for shell script

I created the following bash script in OS X 10.7.5: $ cd ~/Documents/github/scripts $ vim hello_world.sh #!/bin/bash clear echo "The script starts now." echo "Hi, $USER!" echo "I will now fetch ...
1
vote
1answer
49 views

How to open shell scripts in editor when double clicking on them

I'm trying to migrate to OS X. One thing what I find really strange / dangerous that by double clicking on shell scripts, I launch them in Terminal. I would like to change this behaviour to open them ...
0
votes
1answer
18 views

Deleteing Original File After Creating Another

Here is the Script I have so far: #! /bin/bash dd=$(date -v -1d '+%Y-%m-%d') for file in *.csv ; do saveName="${dd} - TF.csv" cut -d',' -f5,8 "$file" > "$saveName" done The file ...
8
votes
2answers
2k views

Why Mac OS X don't source ~/.bashrc [duplicate]

I found a lot of people figuring out why instruction similar to this : Put X to your ~/.bashrc and you can do Y don't work. It always turns out that Mac OS X's bash's startup files (or Mac's ...
2
votes
3answers
89 views

Behavior of login shell vs. Linux, 'sh -c'

I have a seemingly-valid command that works fine on Linux boxes but fails on OSX, and I would like to know why. sudo su - validusername sh -c 'whoami' On Linux, this will echo 'validusername' on ...
1
vote
1answer
42 views

How to find out which terminal app (iTerm or Terminal) is running from within bash

I need to have different color schemes for each of the two terminal types I use. I can set it in the .bash_profile as mentioned here. But how can I tell it to differ depending whether its a iTerm2 or ...
0
votes
2answers
330 views

Set the master password from terminal

I am trying to set a master password from the terminal (using a shell script). I see the passwd function and the master.passwd function, however I don't see any documentation on either of these to set ...
1
vote
2answers
110 views

Terminal.app equivalent of `xterm -e 'cmd'`

With xterm (and gnome-terminal, terminator, etc), you can run the following command: $ xterm -e 'vim somefile.txt' xterm will open and run the specified program (in this case, Vim). When the ...
1
vote
2answers
148 views

What options does Terminal pass to bash on startup?

In the Terminal preferences, I'm able to configure the Terminal to "Open shells with:" -> "Command (complete path):" /opt/local/bin/bash. What options is the terminal passing when invoking this ...
2
votes
2answers
101 views

How do I link/call an actual shell script saved within an Applescript app?

What's the correct syntax in the Applescript below to make this app run by double clicking on it rather than how it runs now by just running the Applescript in the AS script editor? The Shell script ...
0
votes
1answer
166 views

In iTerm, why is a command shell's command not picking up things on my $PATH?

I've got a script in my ~/.bin directory that changes iTerm's background before starting an SSH session (as detailed here, script slightly modified from this version). If I start a regular login ...
0
votes
1answer
32 views

install libsoup on macbook pro

I have a shell script from a open source project, when I run it in terminal, I get the following error: ./configure: line 17678: syntax error near unexpected token `soup,' ./configure: line 17678: ` ...
1
vote
1answer
91 views

What's the BSD equivalent of the linux date command for adding subtracting days/weeks/months from a given date?

I have a given date, such as 2013-10-31 and I need to accurately determine the next day (taking into account DST, leap years, leap minutes, timezones, etc). I also have now way of knowing if the date ...
0
votes
1answer
65 views

SIPS: Only Resize if Image is 315x300?

I'm currently using sips --resampleHeightWidth 250 300 "S1" to resize new images in a folder but I think that it might be resizing images that were already resized.. Is there anyway to know this for ...
1
vote
2answers
648 views

User input assigned to variable in AppleScript then passed to “do shell script” command

How do I grab input from the user in AppleScript and then pass the result of the variable to a do shell script command from within AppleScript itself? For example, the user would type the answer foo ...
0
votes
1answer
138 views

Launch script after command finishes

I find myself running some long scripts/commands and I don't want to wait looking at it until it finishes. On the other hand, I would like to know right away when it ends. I know you can do the trick ...
6
votes
2answers
3k views

Run AppleScript from bash script

If I wanted to run an AppleScript from within a bash script I could call a file with the list of commands that I require to execute. #!/bin/bash {some commands} osascript file.scpt {other commands} ...
4
votes
2answers
275 views

What does -HUP do when used with killall?

Sometimes when I'm running a killall command from Terminal, a co-worker would suggest or edit my scripts to show killall -HUP. What does the -HUP part do?
4
votes
2answers
293 views

Pipe output of grep to a variable

I need to be able to write whether the test for a grep is either TRUE or FALSE to a variable so I can use it later For the following, if I run defaults read com.apple.Finder | grep ...
0
votes
1answer
865 views

Automator won't execute my bash shell script

I have a bash script that works like a thread. Now I'd like to turn it into a service with Automator. Input is set to Image Files in Automator and the shell script action is set to Pass input as ...
1
vote
1answer
232 views

Automator to execute shell script with an input text file, copy it to specific directory

I'm simplifying making a .deb file with Automator. I currently have a shell script that does some simple actions - Ask the user for text input Do some directory parsing Execute a command with the ...
0
votes
2answers
460 views

My Automator Workflow fails because it fails to find the git command within the 'Run Shell Script' command? Need help

I have an Automator workflow and one of the actions is to clone a repository. Here's the code for the 'Run Shell Script' action. The command is run within the Bash shell /bin/bash if that matters: ...
0
votes
0answers
31 views

Why nc doesn't response even if the “w” option set?

For some servers: nc -w 1 -z x.x.x.x 22 doesn't work. It has no response, but is looking like very busy: only ctrl + C can help. So -w 1 seems to be a useless option, to specify the timeout. Does ...
3
votes
2answers
347 views

Are Bash, Bourne, and Korn shells compiled into one binary in OSX?

On OSX 10.8, if you compare the binaries for bash, sh, and ksh, a few different shell options, they are the same size. If you take it further and cmp the binaries, there seems to be only a ...
2
votes
1answer
203 views

how to get ls to list files in case-insensitive order?

How do I get the ls shell command to list my files in: case-insensitive order with the directories at the top? The reason I ask is: I want Aquamacs Emacs dired to list my files and directories ...
1
vote
1answer
44 views

How to change some information in a shell prompt.

I opened my terminal and saw a shell prompt. Last login: Fri Feb 15 15:28:16 on ttys000 john:~ voloda2$ How do I change john to alex?
1
vote
0answers
59 views

Most efficient way to get all files in a directory

I have a million+ files spread across four fiber-connected arrays. I need to get the path, filesize, and last_modified date to insert into a mysql database. What would be the best way to do this? ...
5
votes
2answers
2k views

How to reset $PATH?

I was trying to add something to $PATH and it went totally wrong. I now can't run any commands such as ls. I've looked at this answer and used the following lines: ...
1
vote
2answers
717 views

Why sh -c 'echo -n 1' is different from bash -c 'echo -n 1'

I am on a Mac Book Air, OSX 10.8. I am trying to understand why these two snippets do not print the same output. sh -c 'echo -n 1' outputs -n 1 whereas bash -c 'echo -n 1' outputs 1 as expected. ...
1
vote
1answer
211 views

How can I make autocomplete in the shell work with case-folding?

How can I make the autocompletion for files and folders in the bash shell work case-insensitively? Ideally, cd ~/doc + tab autocompletes to cd ~/Documents (correcting the case as it autocompletes), ...
1
vote
1answer
133 views

logger vs syslog -s

What exactly is the difference between using logger and syslog -s? According to its manpage, logger provides interface to the system log module, but I can't really see the point given that syslog(1) ...
5
votes
2answers
343 views

How can I have my shell always start in a certain directory that is not my home directory

I've tried putting cd /Users/my_name/my_directory/structure in both .bashrc and .bash_login but neither works, i.e. when I open a new terminal window I am in my home (/Users/my_name/) directory. ...
6
votes
1answer
1k views

How can I format the output of ping in bash?

I am using the following script to cycle through a list of IP addresses and report back on the % of packet loss. I'd also like to have the IP address printed first, then its % of packet loss. But I ...
1
vote
2answers
1k views

How to fix locate.updatedb not respecting directory excluded from /etc/locate.rc?

I wanted to exclude some directories from the results of /usr/libexec/locate.updatedb by editing /etc/locate.rc. Unfortunately if I edit locate.rc locate.updatedb runs forever and does not actually ...
1
vote
1answer
346 views

How can I set Last Modified Date of file after using HandbrakeCLI to convert a file?

Running this on OS X Lion. I'm batch converting several hundred home movies using Handbrake CLI. I'd like to set the last modified date and created date to that original file. I'm using the ...
6
votes
2answers
606 views

Change my shell to a different bash version at /usr/local/bin/bash?

How can I set my /usr/local/bin/bash (which is the 4.2 version that allows auto-completion of 'cd to directory with directory name') to be my default bash for a new window instead of my regular ...
11
votes
2answers
871 views

cd to a directory by typing its name?

For example if a directory 'blob' exists and I just type 'blob[return]' then the system cds into the blob directory for me. In Linux (Ubuntu) I can add shopt -s autocd to my .bashrc file, but on OS X ...
3
votes
1answer
351 views

How do I find where an environmental variable got set?

I installed a program to try it out, and decided I didn't like it so I moved the app to the trash. Today, in my shell, I noticed that there are a couple of PROGRAMNAME_BLAHBLAH environmental ...
1
vote
1answer
456 views

Bash problem Mac OS Terminal

Hi when I pressed the up arrow to see the previous command, it rewrote the current command from half. Example: 21 /usr/local/sphinx/etc > /usr/local/sphinx/bin/search --config ...
2
votes
3answers
4k views

/bin/sh: rm: command not found

I have problems with some applications that use AppleScript shell script feature. For example, Growl's uninstall scripts shows an error: error "/bin/sh: rm: command not found" number 127 The source ...
6
votes
2answers
3k views

How do I reset the scrollback in the terminal via a shell command?

When using Terminal.app, you can clear the screen by using the shell builtin clear or by pressing ^+L (Control-L). However, all this does is push the current screen content back one screen height ...
3
votes
2answers
224 views

what is DELUXE-USR-LOCAL-BIN-INSERT in ~/.profile file?

My .profile file includes the following obscure lines. What are they for? ## # DELUXE-USR-LOCAL-BIN-INSERT # (do not remove this comment) ##
0
votes
1answer
50 views

Customizing the shell prompt causes some quirks

I have customized the shell prompt with the following code in my ~/.bash_profile, but there is one quirk left I can't seem to fix: export PS1="\u:\[\e[32;1;32m\W\e[m\] \$ " (code is also on github) ...
2
votes
2answers
996 views

Bash shell script to locate and remove substring within a filename

I am trying to write a bash shell script (which is called by an Automator Action) to rename TV show DVD rips that I have named badly over the years. I want to remove part of the text in the filenames. ...
2
votes
1answer
296 views

Add info to Dock/Menubar from Shell in macOSX

I'm working on MacOSX environnement, but I would like to tweak it a bit. I have a few bash scripts I used in Linux to retrieve infos such as IP, average ping and so, that I would like to be displayed ...
1
vote
3answers
2k views

How to dim (and un-dim) display in automator

For those that are interested in the final script you can get it here original question I am trying to make a alarmclock script to wake me up. but I can't figure out how to change the screen ...
3
votes
3answers
2k views

Opening a terminal window to a specific directory from a bash script

How can I write a bash script in Mac OS X that opens a Terminal window in a specific directory? I'd assume something like: open /Applications/Utilities/Terminal.app But that does nothing (maybe ...
2
votes
1answer
864 views

Why won't wget work with cron?

I've been using the bashpodder script (http://lincgeek.org/bashpodder/) recently, and while the script works beautifully when I use it in the command line, the crontab I created for it doesn't work at ...
7
votes
1answer
10k views

Bash or Zsh, what's the difference, why use one or the other?

So, the question pretty much says it all. I'm on Snow Leopard, and I do a lot of web development, particularly in Rails 3 which makes heavy use of the console. I've seen some notable bloggers etc. ...