Tagged Questions
4
votes
1answer
76 views
Execute multiple bash commands on the output of find
I want to execute some commands using the find -exec option, but I'm not sure what' wrong with this code. Currently, it's only processing the first find result, then getting stuck. I'm using bash in ...
0
votes
0answers
32 views
How to mimic bash tab completion behavior on OS X when using Linux
I'm an OS X user who's used to ssh'ing into various Linux machines. Recently, I installed Ubuntu on one of our servers and have noticed very different tab completion behavior in bash. Among other ...
-1
votes
1answer
57 views
Why is ./filename required to run executable script? [duplicate]
After creating a Python script file, test.py, in my home directory, and running chmod +x test.py to make it executable, and placing #!usr/bin/env as the file header, I expected to be able to run the ...
2
votes
1answer
61 views
Find out where $PATH got corrupted
I'm using OSX Mountain Lion 10.8.2
$echo $PATH prints this:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/myusername/.rvm/bin
I've commented out everything in ~/.bash_profile ...
1
vote
2answers
111 views
OS X setting environment variables
I have OSX 10.8.2 with ZSH as my shell and iTerm as a terminal (don't know if the last thing is relevant). I have to mention that I'm relatively new to OSX.
I'm trying to set up some environment ...
1
vote
3answers
104 views
Print files with file size less than 100 bytes
Basically this script is just supposed to print out the file size and the name of all files in a directory that are under 100 bytes. This script I wrote works perfectly on my Ubuntu, but wont work on ...
3
votes
2answers
92 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
3answers
313 views
How to make bash put prompt on a new line after cat command?
What I get:
host:~ user$ cat example.txt
some texthost:~ stas$
What I want to get:
host:~ user$ cat example.txt
some text
host:~ stas$
Is there a way I can make cat behave like this?
I'm using ...
1
vote
0answers
93 views
Display 'PRI' and 'NI' via 'top -stats'
I'm trying to create a script that prints top stat for some specific fields (e.g. pid, command, priority, nice value). I can print most of them by using -stats option, but there is no arg for ni and ...
2
votes
1answer
439 views
How do I parse namespaces from an XML file using XMLLINT and BASH
Below I have an example of an Adobe XML swidtag used to track inventory. I need to parse out relevant information using xmllint in bash and output that to a new text file.
For example I would like ...
2
votes
1answer
563 views
What happened to ~ when updating oh-my-zsh?
Not sure what changed the meaning of the home path ~ in my zsh.
So when I do cd ~ , I dont cd into my home but it gives me an error that /Users/carlos does not exist.
How can I reset ~ to refer to ...
1
vote
2answers
445 views
Fetch values from plist file on Linux
I have bash script which was written for OS X and now ported to Linux. I don't have access to the Linux box. The bash script would read values from plist files using the defaults read and PlistBuddy ...
1
vote
2answers
308 views
ps aux |grep 'asdf' grep: asdf: No such file or directory
For some reason a while back, the behavior of my command line changed, and I don't know why. Using OSX, now Mountain Lion(although this behavior was present before the switch).
Using standard ...
4
votes
1answer
483 views
Bash history with timestamps
I would like to keep timestamps on the commands logged in my Bash $HISTFILE, is it possible?
I did not manage to set it up using man bash as an information source.
My other options are as follows:
...
2
votes
2answers
664 views
Global bash_profile
I realize there are /etc/profile and /etc/bashrc files for setting global environment variables and maybe I'm just misunderstanding their purposes, but...
Is their a global bash_profile file?
This ...
2
votes
2answers
301 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 ...
1
vote
2answers
973 views
Why the differences in color between SSH terminal sessions in OSX?
I'm trying to get the colors in an SSH terminal session with a CentOS machine to look the same as it does when I'm SSH'd into my Ubuntu server. If I run echo $TERM in both I get xterm-color as ...
14
votes
4answers
504 views
Finding command execution time in hindsight
I've just executed a long-running process from the bash prompt. In hindsight, I wish I'd run time on it, or noted down the time at which I kicked it off.
Is there any way of getting this information ...
0
votes
3answers
728 views
/etc/shadow on Mac
I've been trying to run this Linux passwd-generator file on my Mac. I modified enough the script to make it to work well with directories under OSX:
#!/bin/sh
# build-passwd.sh - creates a password ...
0
votes
3answers
81 views
Weird behaviour case insensitivity with bash on MacOS
~/testing $ echo Hello > hello.txt
~/testing $ echo Goodbye > goodbye.txt
~/testing $ cat goodbye.txt hello.txt > HELLO.txt
^C
~/testing $ ls -l
total 9056
-rw-r--r-- 1 user user 8 ...
1
vote
1answer
317 views
How should I check to see if the remote smb serv is mounted?
I'm pretty new to mount. Basically, I have a remote SMB serv on the local network that I want copy images from a directory on, then repeat every 5 min.
I think what I need to do is make a script that ...
3
votes
1answer
126 views
On OS X, how do I log in interactively as root starting from my normal user account?
I have been doing this for a while:
sudo su -
but it uses 'sh' rather than 'bash', which is what I'd like to do.
Which command will log me in as root and get me a bash shell even if that's not the ...
2
votes
2answers
184 views
Bash Process Substitution does not work as 'root' on OS X
OS X 10.6.8, if I use Bash Process Substitution as 'root', it just doesn't work.
Is it supposed to be so?
Why?
Note: here's what I mean... "<(list)"
mysql -D robottinosino < <(echo ...
4
votes
2answers
564 views
SSH LocalCommand on exit
In ~/.ssh/config you can use the LocalCommand directive to execute a local command whenever you connect to a remote machine via SSH. But how do I execute a command when I exit an SSH connection? It ...
2
votes
3answers
674 views
Issues with .bash_profile and terminal commands
I added some data to my .bash_profile to run two aliases ruby version 19 and the proper gems. As soon as I added the data I could not longer run any commands such as the MacPorts command port nor the ...
2
votes
3answers
2k 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 ...
0
votes
1answer
81 views
Alt-Left on OSX to behave like Alt-Left on Ubuntu [duplicate]
Possible Duplicate:
How to change previous/next word shortcut in bash?
When connected to a ubuntu server bash shell, I can hold alt key and press the left or right keys to move forward or ...
1
vote
0answers
108 views
Editing images with sips doesn't work without being executed directly from Terminal? [closed]
I made a cheesy application with a bash script using CocoaDialog, and within this application I need to modify the size of a photo. So, I researched a little and found the sips command; and it works ...
0
votes
1answer
295 views
Setting LS_COLORS and in a GNU Screen
Is there a way to set a GNU Screen LS_COLORS to that of the default non-screen terminal window?
Is there .screenrc or .screen_profile, I don't understand what happens when a GNU Screen is ...
2
votes
1answer
236 views
Input a list of files & directories to be copied with ditto
I have a short list of files and directories of which I would like to make a flat copy of using ditto in a bash shell. There are approximately 8-10 files and/or directories that need to be copied. I ...
7
votes
1answer
354 views
Screen cuts off beginning of long command when accessed through bash history
I'm using the default versions of bash and screen in OS X Lion.
When I'm in a screen session and I scroll back through the bash history and I come to a command that is long enough to wrap.
I might ...
7
votes
2answers
427 views
How to use the SVN CLI effectively
How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these:
find modified files in directory
commit only SOME of them
selecting them somehow other then ...
2
votes
2answers
1k views
Spaces as line breaks from inline for loop command
Someone care to enlighten me as to why the spaces in the first command seem to be interpreted as line breaks? Also occurs substituting print for echo.
$for l in $( find *.txt -exec head -1 {} \; ); ...
1
vote
0answers
97 views
Why does cd // work? [duplicate]
Possible Duplicate:
unix, difference between path starting with '/' and '//'
On my Mac OS X Lion box, with Bash:
$ cd //
$ pwd
//
$ ls
Applications System cores ...
2
votes
1answer
548 views
how to detect a laptop hibernate/resume(close lid,open) in osx from a bash script
This is a follow on question to
how to trap a suspend a resume from a bash script
How do you a trap the event that occurs when you close the lid and later reopen it from a bash script?
4
votes
1answer
170 views
terminal - having “$” instead of MyComputer:~ me$
Right now in my MacOS X terminal I have MyComputer:~ me$ before all the commands.
In some videos I saw they have just $ - that's much less clutter, how is it done?
5
votes
2answers
636 views
How similar is Apple's terminal.app to a bash terminal on Linux?
I know that Apple's Terminal.app provides a bash shell. Are there any differences between this and a bash on Linux?
9
votes
5answers
1k views
Using text from previous commands' output
I know this is not how terminals work, but I find myself often wishing there was an easy way of using text (copying it, modifying it, etc) that is already on my terminal window history from some ...

