I've just thrown together the following shell script:
cd /home/firefli/webprojects/project1
svn checkout file:///home/firefli/svn/project1/trunk .
rm -rf /home/firefli/public_html/project1
svn export . /home/firefli/public_html/project1
It does work when I do a commit and then run the script manually but I still have a couple of quest...
Hello,
im trying to make a bash script to check if a email address is correct.
I have this regular expression:
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
Source: http://www.regular-expressions.info/email.html
And this is my bash script:
rege...
Hi,
I have the following variable in bash:
var1="this is ok"
and in a file I want fo make in all lines the subst:
_day 23. 45. 56. ...
to
this is ok_day 23. 45. 56.
so I add var1 to the start of the line
I tried with this
sed -e "s/_/${var1}"_"/g" ${filename}
but i get errors
I do not know if this is because the spaces. I...
Hi,
I have a bash script which reads lineas
filename=$
while read LINE
do
......
done < $filename
I wonder how could I store $LINE in a string (my_string) so for each line I can do
echo $my_thing" "$my_string
I tried several things but when I print with echo or printf, $LINE deletes everything before it
Tjans
...
Hi,
I have a set of 10000 files c1.dat ... c10000.dat. Each of these files contains a line which starts with @ and contains a string with spaces specific for this file, lije c37 7.379 6.23.
I have another set of 10000 files kind of determined_cXXX_send.dat (where XXX goes from 1 to 10000). Each of these files has only one line. Each l...
I've got to save the output of the top command into a variable and I do this:
myvar=`top -b -n1 | head -n 18`
The problem is that it seems to be ignoring the return characters, so when I echo the content of $myvar I see something like:
top - 15:15:38 up 745 days, 15:08, 5 users, load average: 0.22, 0.27, 0.32 Tasks: 133 total, 1 runn...
Hi all,
I am doing a bash script and I want to display the characters of a variable ($VAR). What I want the script to do is (pseudo-code) :
String var = "Hello";
for (int i = 0; i < var.length(); i++) {
System.out.println(var.substring(i, i+1));
}
The size of the variable can change, one time it can be 5 characters and the next tim...
Hi,
I Try to parse my dhcpd.lease File with Basel. A typical entry looks like this:
lease 192.168.20.4 {
starts 6 2009/06/27 00:40:00;
ends 6 2009/06/27 12:40:00;
hardware ethernet 00:00:00:00:00:00;
uid 00:00:00:00:00:00;
client-hostname "examle-workstation1";
}
All information i get is the MAC and what i want is...
Hi there,
I am trying to create actions in my project by using,
zf create action add edit
however my command line outputs this message,
An Error Has Occurred
A project profile was not found.
Zend Framework Command Line Console Tool v1.9....
I am writing a bash script that I plan to execute via cron. In this script, I want to execute a command against a MySQL database, something like this:
$ mysql -u username -ppassword -e 'show databases;'
For clarity and those not familiar with mysql, the "-u" switch accepts the username for accessing the database and the "-p" is for p...
Trying to pipe the output of a sed replacement on a text file into MySQL like so:
mysql -D WAR | sed -e "s/2000/$START/g" -e "s/2009/$END/g" < WAR.sql
That's not working. Nor is:
mysql -D WAR < sed -e "s/2000/$START/g" -e "s/2009/$END/g" < WAR.sql
What's the proper solution here?
...
Hi,
I am a newbie with shell scripting but just wanna quickly do something really
simple. I have a testprogram that writes some results into a file "result". I wanna
run the program three times and then store the results in an appropriate file with the
name result1, result2, etc.
I thought something along those lines will do the trick...
In bash, I have created a simple daemon to execute commands when my internet connection changes:
#!/bin/bash
doService(){
while
do
checkTheInternetConnection
sleep 15
done
}
checkTheInternetConnection(){
if unchanged since last check
return
else
execute someCommand
fi
}
someCommand(){...
If I have just entered the following command in Bash:
echo foo
I can change foo to bar by typing:
^foo^bar
Which results in the following command being executed:
echo bar
Now if I enter:
echo foo foo
Is there a way to change both instances of foo to bar just by using the caret (^) operator?
Additionally, are there man pages ...
I am having a hell of a time trying to write a "kill all other daemon processes" function for use within a bash daemon. I do not ever want more than one daemon running at once. Any suggestions? This is what I have:
#!/bin/bash
doService(){
while
do
something
sleep 15
done
}
kil...
I'm running a program and redirecting cout to an outfile, like so:
./program < infile.in > outfile.o
I want to be able to read in an option ('-h' or '--help') from the command line and output a help message to the terminal. Is there a way I can do this but still have the regular cout from the rest of the program go to the outfile?...
What is the quickest and most pragmatic way to combine all *.txt file in a directory into one large text file?
Currently I'm using windows with cygwin so I have access to BASH.
Windows shell command would be nice too but I doubt there is one.
...
Hi, I'm looking to update twitter using cURL. I've written a bash fuction, but I'm not sure how to get it to accept a line as an argument to use as status text. The current function just accepts the first word as an argument. Also, can I prevent it from returning the XML file or suppress it from going to stdout?
Thanks
#!/bin/bash
f...
I need to have the ability to create user accounts on my Linux ( Fedora 10 ) and automatically assign a password via a bash script ( or otherwise, if need be ).
It's easy to create the user via Bash eg:
[whoever@server ]# /usr/sbin/useradd newuser
But is it possible to assign a password in Bash, something functionally similar to thi...
Good Evening,
I am pretty new to Unix so maybe this mini project is too ambitious. Hoping someone could point in in the right direction.
Working in a cubicle and I can't see how light it is outside. In general I use a yellow terminal in the morning (sunny) and a black/green past 3:00 (night).
What I would like to do (partly just...