I want to write a shell script in bash to deploy websites from an svn repository. When I deploy a website, I name the exported directory *website_name*-R*revision_number*. I'd like the bash script to automatically rename the exported directory, so it needs to learn the current revision number from the export directory. If I run
$> svn ...
I have a pair of bash scripts, 1 that dumps mysql dbs, and the second to purge old backups.
I have always relied on date, so any files older than 7 days are purged, and new backups created daily. The result was a set of backups 7 days back.
Well now that I have 20+ dbs I have separated that daily job into a daily, and weekly job. If I...
Hi,
I wonder if it is possible in bash for OSX to create a script for which we give as input the application name and a number N, so this app gets opened in the Space's space number N.
I would like with this to create a meta-script, so when the computer boots and after login, on each space I get different apps, and important, I can cha...
Is there a way to store binary data inside a BASH script so that it can be piped to a program later in that script?
At the moment (on Mac OS) I'm doing
play sound.m4a
# do stuff
I'd like to be able to do something like:
SOUND <<< the m4a data, encoded somehow?
END
echo $SOUND | play
#do stuff
Is there a way to do this?
...
The following code from my configuration.ac file does not work (note the nested square brackets with [default=no]):
AC_ARG_ENABLE(debug,
[ --enable-debug build with debugging support [default=no].],
[DEBUG="$enableval"],
[DEBUG="no"]
)
How can I escape those brackets?
...
hello,
Is it possible to have multiple unary operators in if statements.. Here is the code snippet which is giving me error.
Please correct the code here.
if [ -f $input_file ] -a [ -f $output_file ] -a [ -f $log_file ] ]
then
### Some Code here
fi
Thanks
Kiran
...
I have a bash script in which i check the exit code of a last run command by using $? variable but now I am executing a C program (from that script) which returns 0 if the program gets executed successfully. Is there any way I can catch this return value of the C program from with in my bash script?
I believe different commands like awk...
Hi Guys
Im trying to give a visual output for a file listing i have. What i want to be able to do is display a tick box beside each line from the file
I have thrown together the following zenity command but my main problem is my file listings can be quite long. From the command below i define the values by TRUE "" or FALSE ""
My que...
Why would you prefer to keep from using bash commands via exec() in php?
I do not consider portability issue (I definitely will not port it to run on Windows). That's just a matter of a good way of writing scripts.
On the one hand:
I need to write much more lines in php then in bash to accomplish the same task.
For example, when I n...
Hello,
Is it possible to take the difference of two arrays in bash..
Would be really great if you could suggest me the way to do it..
Code :
Array1=( "key1" "key2" "key3" "key4" "key5" "key6" "key7" "key8" "key9" "key10" )
Array2=( "key1" "key2" "key3" "key4" "key5" "key6" )
Array3 =diff(Array1, Array2)
Array3 ideally should be :
Ar...
Ok, maybe I'm doing something really stupid.
I'm on OSX 10.6.1.
I want to add mysql to my path, so I add the following to my .bashrc
PATH = ${PATH}:/usr/local/mysql/bin
export PATH
upon running terminal, it doesn't work, which I expect, because .bash_profile is not loading .bashrc at the moment.
but if I manually enter bash, i get ...
Say if i wanted to do this command:
(cat file | wc -l)/2
and store it in a variable such as middle, how would i do it?
I know its simply not the case of
$middle=$(cat file | wc -l)/2
so how would i do it?
...
I have moved my classes from a global namespace into a specific namespace. I have also changed the class names. I want to convert all my source files that use these classes to the new format. I was thinking either a bash script using a sed file on Cygwin or executing a perl script. I'm having troubles with the bash script.
Here's th...
We're using git with a central repo (using Gitosis). I've created a post-receive hook to generate an email to the dev mailing list whenever changes are pushed to the central repo, and to generate documentation from the documentation folder in the git repo.
Therefore, in ~git/ I've got a directory, we'll call it 'a' that contains a clone...
I often use the find command to search through source code, delete files, whatever. Annoyingly, because Subversion stores duplicates of each file in its .svn/text-base/ directories my simple searches end up getting lots of duplicate results. For example, I want to recursively search for uint in multiple messages.h and messages.cpp files:...
Hello,
I have a problem putting the content of pwd command into a shell variable that i'll use later. Here is my shell code (the loop doesn't stop):
#!/bin/bash
pwd= `pwd`
until [ $pwd = "/" ]
do
echo $pwd
ls && cd .. && ls
$pwd= `pwd`
done
Could you spot my mistake please?
Thanks a lot for your help...
I'm not able to check the return values of the function test; man test didn't help me much.
#!/bin/bash
test=$(test -d $1)
if [ $test -eq 1 ]
then
echo "the file exists and is a directory"
elif [ $test -eq 0 ]
echo "file does not exist or is not a directory"
else
echo "error"
fi
...
Script runs fine in Solaris and Linux just not on the crippled MAC -- thus no build environment
#!/bin/bash
var0=1
LIMIT=60
mkdir Application
cd Application
while [ "$var0" -lt "$LIMIT" ]
do
mkdir "$var0";
cd $var0;
for i in $(seq 1 8192);
do mkdir "${i}";
cd "$i";
dd if=/dev/urandom of=a bs=4096 count=1 > /dev/...
I'm writing scripts that will run in parallel and will get their input data from the same file. These scripts will open the input file, read the first line, store it for further treatment and finally erase this read line from the input file.
Now the problem is that multiple scripts accessing the file can lead to the situation where two...
I'm trying to get this script to basically read input from a file on a command line, match the user id in the file using grep and output these lines with line numbers starting from 1)...n in a new file.
so far my script looks like this
#!/bin/bash
linenum=1
grep $USER $1 |
while [ read LINE ]
do
echo $linenum ")" $LINE >> usrout
$linen...