1
vote
2answers
34 views

Attempting to run find command gives “Permission denied”

I am attempting to obtain a list of applications on my Mac using find to search for *.app. However, when running the command, I get a lot of Permission denied messages, as below. The computer is mine ...
0
votes
1answer
46 views

Terminal malfunction when running some executables

Short version I overwrote /bin/sh with something else and now I am having issues with terminal. How/can I restore/reinstall /bin/sh? Long version I think I did something silly. I was searching help ...
3
votes
0answers
12 views

how to run alias using bash -c from IDEA

I'm trying to run a program defined in an alias (and the alias is defined in a source file) alias myapp="/somepath/app -arg1 -arg2" Then I go to IDEA and create an External Tool Program: Bash ...
1
vote
2answers
110 views

Shell variable PROMPT_COMMAND not working as intended?

I want my bash prompt to change depending on external conditions. Here is excerpt from the bash manual: PROMPT_COMMAND: If set, the value is executed as a command prior to issuing each primary ...
0
votes
2answers
40 views

chsh doesn't change $SHELL

I'm having some difficulties in changing the value of $SHELL in OSX's iTerm app. iTerm is starting in /bin/zsh, but the value of $SHELL doesn't seem to change. What I've done: Changed "command" as ...
3
votes
3answers
106 views

Shell scripting: Select folder based on part of file name

My project I'm creating a bash shell script to execute from the Terminal. Its purpose is to archive lots and lots of project folders. Each folder follows a prescribed nomenclature: [YYYY.MM.DD] - ...
2
votes
1answer
58 views

Shell script: Move folders + preserve structure

My goal I organize my projects into folders. These folders all live in my Completed projects folder. I am beginning to archive them into an Archived Projects folder, and I want to archive them in ...
1
vote
1answer
67 views

ffmpeg working from command line in Terminal but not in an Automator shell script!

I have just compiled my own copy of ffmpeg on my system and it's located in the following path: /opt/local/bin/ffmpeg When I run the following command in Terminal.app, it runs smooth: ffmpeg -i ...
2
votes
1answer
203 views

How does this complex BASH shell script work?

Apple Support Community member Linc Davis developed this command to aide in diagnosing issues. The output gives a general overview of one's system and is very similar to the program etrecheck. But, it ...
2
votes
4answers
269 views

How to open a new Terminal tab in current working directory?

I want to create and run a bash function that: cd into a project's directory Open a new tab in Terminal in the same directory Open my dev tools and start dev services Item #2 doesn't work as ...
1
vote
1answer
254 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
72 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
7k 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
129 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
59 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
995 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 ...
2
votes
2answers
184 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
211 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
117 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
292 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
47 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
110 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
92 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
1k 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
192 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
5k 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} ...
5
votes
2answers
716 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
340 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
1k 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
260 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 ...
1
vote
2answers
640 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
33 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
397 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
230 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
45 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
61 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
3answers
3k 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
812 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
236 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
139 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
453 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. ...
7
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
367 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
685 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
992 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
358 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
478 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 ...