shell

Running shell commands without a shell window

With either subprocess.call or subprocess.Popen, executing a shell command makes a shell window quicky appear and disappear. How can I run the shell command without the shell window? ...

Char error C langauge

i have a project for a course, i did almost everything but i have this error i dont know who to solve it... the project about doing our own shell some of them we have to write our code, others we will use the fork method.. this is the code, #include <sys/wait.h> #include <dirent.h> #include <limits.h> #include <errno.h> #include <std...

Shell script to test whether a directory exists and if not create it?

I am trying to create a script to detect whether a directory exists, and if it does not, to create it. How can I do that? I did some digging and found a clue: test -d directory ...will return true or false depending on whether the directory exists or not. But how do I tie this together with mkdir? ...

piping to variables

cut -d" " -f2 ${2} | $callsTo hello, can somebody please explain can I pipe the result of cut to variable callsTo, and how will it be stored, as the string or list? ...

Calling an svn update from a php script via a browser is not working

Hey guys, I have two scripts. running an update and calling shell_exec('svn update') and shell_exec('svn st') running a mysqldump shell_exec('mysqldump params') The svn script is not running the update command, the svn st is printing results but not the svn update I tried to declare parameters when calling svn update eg 'svn upda...

Optimize grep, awk and sed shell stuff

I try to sum the traffic of diffrent ports in the logfiles from "IPCop" so i write and command for my shell, but i think its possible to optimize the command. First a Line from my Logfile: 01/00:03:16 kernel INPUT IN=eth1 OUT= MAC=xxx SRC=xxx DST=xxx LEN=40 TOS=0x00 PREC=0x00 TTL=98 ID=256 PROTO=TCP SPT=47438 DPT=1433 WINDOW=16384 RES=...

Windows GUI Automation

Hello, I am planning to automate some of the functionality of the GUI developed in Microsoft Visual C#. I am new to Automation with GUI. Would be glad if you share your experience regarding GUI Automation and some of the tools available for the automation. I plan to develop some programms / scripts in order to realise some of the fun...

How can I write a here doc to a file in bash script?

How can I write a here document to a file in bash script? ...

Access shell methods in controller? Cake PHP 1.3

I wrote a shell method in CakePHP 1.3 that has a return value. I'd like to be able to access that method from within a controller, so that I can pass its return value into the View. I'm not sure how to access those methods appropriately from within the controller. Have I done it wrong? I could easily duplicate the code, but I'd lik...

Set apache documentRoot to symlink (for easy deployment)

we are looking for a way to point our Apache DocumentRoot to a symlink. E.g. DocumentRoot /var/www/html/finalbuild finalbuild should point to a folder somewhere like /home/user/build3 when we move a new build to /home/user/build4 we want to use a shell script that changes the symbolic link "finalebuild" to this new directory /home/user...

How to declare and use boolean variables in shell script?

Title. The way I tried declaring a boolean variable is by: variable=$false variable=$true Is the syntax correct? Also, if I wanted to update that variable would I just do the same format? Finally, is the following the proper syntax for using boolean variables as expressions: if [ $variable ] if [ !$variable ] Thanks! Any help is...

Php/Shell remote SVN tarballs

I'd like to set up daily tarballs/zip archives on my host for an SVN of a related project. I do not have access to their server, however they do have a publicly accessible SVN. How would I grab this SVN and build archives with minimal load ( dreamhost shared ), via Cron task + php/shell script? ...

appending text to all files that starts with a string

How do I append a string to all the files in a directory that starts with a particular string? I tried, cat mysig >> F* But instead of appending contents of mysig to all files starting with F, it creates a file named "F*". Obviously wildcard doesn't seem to work. Any alternatives? Thanks in advance. Edit: Also how do I delete this n...

grep options (unix)

hello everyone, can You explain please, can grep pick rows if at least one element from the list appeared, for exmaple grep "hello world" file1 grep must give me all rows which have or word hello or world or both of them, thanks in advance ...

Printing values in special format using printf

I need to print the following values with printf as the follwoing around like this: printf "[`date +%d"/"%b"/"%G"-"%T`] [WARN] $PARAM1 $PARAM2 $PARAM3 The required output: [02/Jun/2010-11:08:42] [WARN] val1....val2...val3 the gap between val1 to val2 and from val2 to val3 must be const gap not depend the length of the values ...

sed 's/this/that/' -- ignoring g but still replace entire file

as title said, Im trying to change only the first occurrence of word.By using sed 's/this/that/' file.txt though i'm not using g option it replace entire file. How to fix this.? UPDATE: $ cat file.txt first line this this this this $ sed -e '1s/this/that/;t' file.txt first line this // ------> I want to change only ...

script to delete all /n number of lines starting from a word except last line

how to delete all lines below a word except last line in a file. suppose i have a file which contains | 02/04/2010 07:24:20 | 20-24 | 26 | 13 | 2.60 | | 02/04/2010 07:24:25 | 25-29 | 6 | 3 | 0.60 | +---------------------+-------+------------+----------+-------------+ 02-04-2010-07:24 --- ER...

AWK scripting :How to remove Field separator using awk

Need the following output ONGC044 ONGC043 ONGC042 ONGC041 ONGC046 ONGC047 from this input Medium Label Medium ID Free Blocks =============================================================================== [ONGC044] ECCPRDDB_FS_43 ac100076:4aed9b39:44f0:0001 195311616 [ONG...

Extract IDs from CSS

I've the CSS file with many entry like #id1, #id2, #id3, #id4 { ... } #id3, #id2 { ... } #id2, #id4 { ... } I want to extract list of unique IDs using command line tools (msys). Unique means any entry in list presented only once. How? PS: I know how doing it using python, but what about awk/sed/cat? ...

Shell script for testing

I want a simple testing shell script that launches a program N times in parallel, and saves each different output to a different file. I have made a start that launches the program in parallel and saves the output, but how can I keep only the outputs that are different? Also how can I actually make the echo DONE! indicate the end? #!/bi...