Hey there,
I just found this very usefull shell script here on SO but unfortunately it's not working on Mac OS X 10.5.
This is the script in question(copied it for convenience):
#!/bin/bash
LIMIT=$1
P=$PWD
for ((i=1; i <= LIMIT; i++))
do
P=$P/..
done
cd $P
I tried to echo $P at the very end and it's returning the right path, but...
So far I've come up with this:
find . -name 'CVS' -type d -exec rm -rf {} \;
It's worked locally thus far, can anyone see any potential issues? I want this to basically recursively delete 'CVS' directories accidently uploaded on to a server.
Also, how can I make it a script in which I can specify a directory to clean up?
...
Ok, this is my third try posting this, maybe I'm asking the wrong question!!
It's been a few years since I've done any shell programming so I'm a bit rusty...
I'm trying to create a simple shell script that finds all subdirectories under a certain named subdirectory in a tree and creates symbolic links to those directories (sounds more...
Lets say I have a log file from a web server with response times per request:
_1st_request 1334
_2nd_request 345
_3rd_request 244
_4th_request 648
......... etc
Is there an easy way with bash scripting to find the top decile (10-quantile)? In other words to answer the question: How slow was the slowest request if I exclude the slowest...
I'm fairly new to programming and I searched the internet for a way to pass bash output to a Python script.
I came up with this in bash.
XAS_SVN=`svn info`
ssh hudson@test "python/runtests.py $XAS_SVN"
And this in python.
import sys
print sys.argv[1]
When I echo $SVN_INFO I get the result.
Path: . URL:
//svn/rnd-projects/te...
the problem is as the title. thx!
...
I was struggling with how to use TFS as a source code repository for iPhone development.
My boss will never let me use Subversion (or God forbid Perforce), so I was stuck with TFS source control.
The solution is to go and buy tools to bridge Mac to TFS, and I am not trying to advertise here, but the Teamprise Client Suite for Mac OS X ...
(edited to fit the answer)
Looking the "Array" section in the bash(1) man page, I didn't find a way to slice a bash array.
So I came up with this overly complicated function:
#!/bin/bash
# @brief: slice a bash array
# @arg1: output-name
# @arg2: input-name
# @args: seq args
# ----------------------------------------------
function...
I am batch converting some pictures with a quick and dirty bash script using ufraw :
IFS=$'\n'
PICS="/media/disk/kevin/Images/";
for pic in $(find $PICS -name "*CR2");
do
ufraw-batch $pic --out-type jpg --size=2048 --overwrite --out-path=$PICS;
rm -f $pic
done;
IFS=" ";
It's running fine with the usual rights, but if I run it ...
Textmate does not source my .profile file. I don't have a custom bash_init.rb, nor do I have a .bash_profile or .bash_login in my home directory (the other two files it checks first).
My .profile gets sourced properly when I start up terminal
...
We have a system that has some bash scripts running besides Java code. Since we are trying to "Test Everything That Could Possibly Break" and those bash scripts may break, we want to test them. The problem is it is hard to test the scripts.
Is there a way or a best practice to test bash scripts?
Or should we quit using bash scripts and...
I'm not sure if this is possible or not,
Basically, I'm writing a script that allows me to scp a file to my hosting. This is it so far. Arg 1 is the file and arg 2 is the folder i want it to be placed in on the remote server
function upload {
scp $1 [email protected]:$2
}
As you may/may not know, if the directory I specify wh...
The only way I know is:
find /home -xdev -samefile file1
But it's really slow. I would like to find a tool like locate.
The real problems comes when you have a lot of file, I suppose the operation is O(n).
...
I'm having difficulty getting the awk command inside a bash script to work. The script follows:
#!/bin/bash
fpga-test -1 -a $1 > tmp.file && awk \'\/Read\/ {print \$2}\' tmp.file
When I run the command I get the following error.
# my_script 14
awk: cmd. line:1: Unexpected token
The intermediate file (tmp.file) looks like this, an...
I have a bash script that simply calls different calls and redirect stdout and stderr outputs to different files.
I've done this:
command 1> datafile 2>> errorfile
However, when the command is erroneous (e.g. wrong username and password combination given as arguments), the error message does not get redirected to the errorfile. I sti...
After looking at this post, it looks like I can just use cat to merge files.
However, I am a bit confused on how to do this with my array of filename prefixes.
For example:
prefixes=( pre1 pre2 pre3 pre4 pre5 )
If I have an array of prefixes like that, how can I make a command to look like this or do something similar to this:
cat p...
Hi,
I have long file with the following list:
/drivers/isdn/hardware/eicon/message.c//add_b1()
/drivers/media/video/saa7134/saa7134-dvb.c//dvb_init()
/sound/pci/ac97/ac97_codec.c//snd_ac97_mixer_build()
/drivers/s390/char/tape_34xx.c//tape_34xx_unit_check()
(PROBLEM)/drivers/video/sis/init301.c//SiS_GetCRT2Data301()
/drivers/scsi/sg.c/...
I'm trying to execute this:
$ mysql --user=XXX --password=XXX --batch --skip-column-names \
-e "SELECT userid, displayname FROM Users" stackoverflowdb | \
split -l 50 -a 5 - "result."
but bash complains about ) 'unexpected' character (i have this character and few other 'weird ones' in my mysql password). I tried to take my password ...
In a bash script, I'm using wine to call a DOS program that requires me to "Press Enter to exit". How do I do that automatically and continue with the rest of the script?
...
Hi there,
We have a cluster of 4 web servers which contain a few domains, one of which contains quite a lot of videos. We also have a 'staging' server which we usually sync/upload files to and then from there rsync them all out via a bash script to the other web servers.
The problem we have is that quite a bit of this is manual. If in ...