unix

Rspec: run just a few testcases from file

I have a bunch of tests in my spec file and in this way I run just one of them: rake spec SPEC=spec/integration/gardens_spec.rb SPEC_OPTS="-e \"should foo\"" If there is any way to run 2-3 of them with a single command(let's call those testcases "should bar" & "should baz")? ...

sql from shell script

Hi, I have the below shell script in which sql file is called which has set of select and insert statements. Right now it's spooling output/error of the sql select /insert commands to the csv file. I want the output and error of the sql commands redirected to the shell script LOGFILE instead of spool file. How can i do it. LOGPATH=${...

ImageMagik/UNIX: How to recursively process a nested directory of photos?

Question: How do I recursively process, using Imagemagik (convert), a nested directory of photos? I have the following directory structure: / ..2008/ ....a.jpg ....b.jpg ..2009/ .....c.jpg And I want to run the following ImageMagik command on each file, to clean/resize up the images, and then save the resulting image out as the exact...

Set a name for screens with the 'screen' command

Hi, I'm using the 'screen' multiplexer tool on the command shell and open a lot of screens. So I forget wich process ID is wich task. I Would like to set a name for a screen but can't find an option in the manpage. So it looks like this: There are screens on: 5422.pts-1.aws1 (Detached) 5448.pts-1.aws1 (Detached) 5027.pts...

help with unix tar and grep loop

Hi I would like some help in creating a loop that will take one of my files extension .tar.gz unzip it untar it and search the files inside (with extension .tlg) using grep -a >> output.text. In the outout.text i will require the matching data as well as the name of the file and parent tar it came from one this search has been perfo...

Unix sockets programming: port is not getting unbound after server shutdown

Hi. I'm studying Unix sockets programming. I made a time server that sends raw time data and a client for it that receives that data and converts it to local time. When I run the server, connect a client to it (which causes both of them to do their job and shutdown) and then rerun the server, I get errno = 98 on bind() call. I have to c...

unix shell programming special variables

I need a good reference on unix shell special variables (csh, ksh and bash). e.g. $1, $*, $#, etc. ...

can i display the my name 10 times what is the commands in shell script

tel me the answer the above question ...

How to use unix scripts to show all 'n' characters long group of strings?

This IS kind of linked to another question - http://stackoverflow.com/questions/3171552/code-golf-color-highlighting-of-repeated-text I'm tying to figure out a way of breaking a file into all 'n' characters long groups. Eg: If a file comprises of ONLY the following text: ABCDEFGHIJ And we want it broken into sets of 3, the output sh...

for i in ls - Unix syntax

what is wrong with this? for i in 'ls | grep '^[A-Z]......$' do echo $i done if i just use the command ls | grep '^[A-Z]......$ i get the files i want What am i missing? M ...

ssh to different machine to find the number of file.

echo "`${BOLD}` ***** Checking CoreFile Creation *****`${UNBOLD}`" echo "========================================================" IFS='|' cat configMachineDetails.txt | grep -v "^#" | while read MachineType UserName MachineName do export CHK_COREFILE=`ssh -f -T ${UserName}@${MachineName} ls ~/corefiles ...

shell script create string of repeated characters

This seems like a simple problem but I couldnt find a ready solution. I need to generate a string of characters "."s as a variable. ie, IN my bash script, I need to generate a string of length 15 ............... I need to do so variably. I tried using this as a base (from: http://www.unix.com/shell-programming-scripting/46584-repeat-ch...

regex for unix script

can anyone help me with a regex that will find files that dont have a .tar.gz extension i need it to work in my unix script for i in <REGEX for non tar.gx files> do something done thanks ...

Simulate User Input To Call Script Multiple Times With Different Parameters

I have to use a provided script that takes user input while the script is running instead of parameters. I can't get around this. An example of script would be: #!/bin/bash echo "param one" read one doSomething echo "param two" read two doSomething echo "param three" read three doSomething echo "param four" read four doSomething e...

NFS home / .profile / 3 flavors of UNIX : best practices?

Three flavors of UNIX: Linux, Solaris, IRIX... one NFS mounted home directory. I'd like to have a (slightly) different .profile behavior based on the OS that I'm connecting to. I can hack something together, but I'd like to not re-invent the wheel if it's not necessary. Is there a best practice for splitting out .profiles sections base...

Shell script to find, search and replace array of strings in a file

This is linked to another question/code-golf i asked on http://stackoverflow.com/questions/3171552/code-golf-color-highlighting-of-repeated-text I've got a file 'sample1.txt' with the following content: LoremIpsumissimplydummytextoftheprintingandtypesettingindustry.LoremIpsumhasbeentheindustry'sstandarddummytexteversincethe1500s,whenan...

How to rename() without race conditions?

If I want to rename A to B, but only if B doesn't exist, the naive thing would be checking if B exists (with access("B", F_OK) or something like that), and if it doesn't proceeding with rename. Unfortunately this opens a window during which some other process might decide to create B, and then it gets overwritten - and even worse there's...

for i in `ls |grep` question

This is the code i'm using to untar a file grep on the contents of the files within the tar and then delete the untared files. I dont have enough space to untar all files at once. the issue i'm having is with the for f in `ls | grep -v *.gz line this is supposed to find the files that have come out of the tar and can be identified by no...

Signals in fork

What is signal behavior in the fork. Should all signals are inherited in fork If not then which one and why? ...

Chaining commands to use ls to recursively list files modified in last 24 hours?

Hi, Can someone help me with chaining commands to use ls to recursively list all files modified in last 24 hours? Thank you!!!! JG ...