[Solved]
See post by Dave Kirby.
EDIT:
Here is my updated code:
#!/bin/sh
files=`ls`
if [ $# -ne 1 -o -f $1 ]
then
echo "Usage: $0 <directory>"
exit 1
fi
if [ ! -e $1 ]
then
echo "$1 not found"
exit 1
elif [ -d $1 ]
then
cd $1
for f in $files
do
if [ ! -d "$f" ]
then
if [ ! -...
How do you check if a process on Mac OS X is running using the process's name in a Bash script?
I am trying to write a Bash script that will restart a process if it has stopped but do nothing if it is still running.
...
Python provides a signals module and os.kill; does it have a facility for sigqueue() (real-time signals with attached data)? What are the alternatives?
...
How to grep tab (\t) in the file on Unix platform
...
i have created a job with at command on solaris 10
it's working now but i want to kill it but i dont know how can i find job number and how to kill that job or process
any help ?
...
Hi
I'm working currently on a small microhpone, connected to PC via an FPGA. The FPGA spits a raw datastream via UART/USB into my computer. I'm able to record, play and analyze the data.
But I can't play the "live" audiostream directly.
What works is saving the datastream in PCM raw-format with a custom made C-program, and piping the ...
I'd like to find out how current google's cached copy of a large set of pages is. I think I need to
look in the logs for IP's,
check to find user-agent "googlebot", then
export a list that says each page and when it was last visited.
I imagine this could be a cron job that runs weekly. If this is right, how would I write the s...
I have inherited this sed script snippet that attempts to remove certain empty spaces:
s/[\s\t]*|/|/g
s/|[\s\t]*/|/g
s/[\s] *$//g
s/^|/null|/g
that operates on a file that is around 1Gb large. This script runs for 2 hours on our unix server. Any ideas how to speed it up?
Notes that the \s stands for a space and \t stands for a tab, ...
Does any one have a snippet of their code that, checks if the network is enabled on a machine and has an active IP Address.
I have a networking software that connects to other client machines, Although it works when the machine is connected but if i unplug the cable or disable the network, It throws a whole reem of exceptions.
It woul...
People these days create their ZIP archives with WinZIP, which allows for internationalized (i.e. non-latin: cyrillic, greek, chinese, you name it) file names.
Sadly, trying to unpack such file causes trouble:
UNIX unzip creates garbage-named files and dirs like "®£¤ ©¤¥èì".
Java and its jar command fails miserably on such archives.
I...
i have a table in a oracle database in which one of the field is a clob field.
the clob field is having several xml file.
now if i want to export that xml file into a text file on unix how do i do it?
NOTE: i dont have any gui like toad installed for the server and i have to only use the unix environment for it.
could you please tell m...
In linux, how do I check if someone has not yet committed something?
I remember I made changes on a server once..but forgot to commit. Now, I don't know which server I used to make those changes.
...
I've setup a simple TCP file transfer. Everything appears to work OK, except for the received file size is sporadically a smaller size than the file that was sent. There doesn't appear to be any pattern to the size of the received file.
(in the code below, note that the typical client/server rolls are reversed)
My client code is like...
We recently had a problem with our test LDAP server - it was hung and wouldn't respond to requests. As a result, our application hung forever* while trying to bind to it. This only happened on Unix machines - on Windows, the ldap_simple_bind_s call timed out after about 30 seconds.
* I don't know if it really was forever, but it was at ...
I'm using subversion so that I can have two checkouts, one for testing to make sure things work and another which is public live site. I made some changes in the test site but also made some updates to a wordpress install. Now I can't commit the changes on my live site.
[phil@sessions public_html]$ svn commit -m "this time, it's perso...
Lets state the conditions where sqlcxt() can cause segmentation fault, I am woking on unix, using ProC for database connections to Oracle database.
My program crashes and the core file shows that the crash is due to the sqlcxt() function
A loadobject was found with an unexpected checksum value.
See `help core mismatch' for details, and...
NOTE: This is not the same question as Python: Persistent shell variables in subprocess, as that question is actually about environment variables, not shell variables.
I'm trying to automate a basic benchmark that I'm doing in csh using the shell built-in time command. You can tweak the output of time by setting the variable of the sam...
I have data like this:
# data_display
ab as we hj kl
12 34 45 83 21
45 56 98 45 09
I need just the first column alone, and only the rows starting with numbers.
I now use:
# data_display | awk '{ print $1 }' | grep "^[0-9]"
Is there any way to optimise it more, like using the regex in awk itself?
I am very new to awk.
Tha...
I am having a function:
int getparam(char *gotstring)
and i am passing the a string argument to it i.e., a string
for eg:
char *sendstring="benjamin"
instead of teh above declaration can i use
int getparam(char gotstring[])
which one is better. and if i have to use int getparam(char gotstring[]) what are all the other changes...
In a UNIX-y way, I'm trying to start a process, background it, and tie the lifetime of that process to my shell.
What I'm talking about isn't simply backgrounding the process, I want the process to be sent SIGTERM, or for it to have an open file descriptor that is closed, or something when the shell exits, so that the user of the shell ...