HI all,
I wrote this code but it doesn't catch any of the two variables being null, why?
echo "$var1 - $var2"
if [ "$var1" == ""] || [ "$var2" == ""]
then
echo "Incomplete data"
exit 1
fi
The initial echo prints nothing for the variables when I run my script so the if statement should work right? But it doesn't for some reason.
...
Hi,
I getting space delimited list of titles based on this code:
TITLES=`awk -F'|' '{print $1}' titles.txt | cut -d'=' -f2 | sort
Then I use that list in a for loop to print out the results:
for T in $TITLES
do
echo "$T"
done
The problem is that when a title has more than one word and the words are separated by a space then m...
I want a way to kill a random process with a name (eg a random perl process).
What would be the best way of doing this?
I was thinkign of using something like this:
ps aux | grep PROCESS-NAME
to a file, then find a random line number, get the second column (process ID?) and kill that.
For my use it doesn't actually need to be a ...
Hi,
if i redirect to same file it places null in the resultant file.
sed 's/abd/def/g' a.txt > a.txt
i know it put null in to the file.
But can anyone explain why?
...
How do I check a int variable ($inputNo) to see if it’s 2 or more decimal digits long?
Example:
inputNo="5"
Should be changed to: 05
inputNo="102"
Should be left alone: 102
I thought about using wc and if statements, but wc -m doesn’t seems to give the actual characters passed into wc, as wc always seems to give +1 to the charact...
I start background process from my shell script.
And I would like to kill this process when my script will be finished.
How to get pid of this process from my shell script?
As far as I can see variable $! contains pid of current script not background process.
...
I use tcsh , and when Delete/End is pressed on cmd line, it simply shows up as ~ ; I have to press <Ctrl><e> to go to end of line. Can anyone help me to be able to use Delete/End keys as their name suggests ?
...
I am aware that this is nothing new and has been done several times. But I am looking for some reference implementation (or even just reference design) as a "best practices guide". We have a real-time embedded environment and the idea is to be able to use a "debug shell" in order to invoke some commands. Example: "SomeDevice print reg xy...
How can I spawn a process after a delay in a shell script? I want a command to start 60 seconds after the script starts, but I want to keep running the rest of the script without waiting 60 seconds first. Here's the idea:
#!/bin/sh
# Echo A 60 seconds later, but without blocking the rest of the script
sleep 60 && echo "A"
echo "B"
echo...
Hello, i've a .csv file like this :
[email protected],2009-11-27 01:05:47.893000000,xx2.net,127.0.0.1
[email protected],2009-11-27 00:58:29.793000000,xx3.net,255.255.255.0
[email protected],2009-11-27 00:58:29.646465785,2x3.net,256.255.255.0
...
I have to remove similar e-mails ( the entire line ) in the file. The problem is how...
I've seen somewhere that we can use >> in shell.
What's the difference between using > and >> in shell?
...
So I do a lot of shell scripts and I am constantly having to enter in paths and I was wondering if anyone knew of a way to get vim to autocomplete paths and files while in insert mode. Just like when you are in your favorite shell you tab to complete the directory or file.
Extra credit if you can get CTRL-D functionality of the shell i...
Hi *,
I'm trying to find out if my install scrip is running on a Mac or Linux device.
Can someone give me a hint?
Thanks
Burntime
...
I was trying to make cat1.txt as a variable ($2) so that it will be inserted in sql select statement. Is there a way to do this?
my cat1.txt
1111
2334
2234
3333
4444
....
....
etc.
my SQL Statement
set echo off linesize 280 pagesize 0 newpage 0 feedback 1 verify off head off trimspool on
alter session set sort_area_size=10485760...
Hi all,
I attached a listener to the Shell on SWT.MouseUp and SWT.MouseDown events, but the handleEvent method never gets fired. I tried clicking at many places on the window, but it doesn't get even to the System.out.println(..) in the code below...
Do you spot any error here?
Thank you!
//c is a Composite.
final Listener l = new L...
As described in one of the answers to SO question "Any way to use a custom diff tool with cleartool/clearcase?" I have installed WinMerge and a single diff opens fine in WinMerge based on a command of the form
cleartool diff -g filename filename@@clearcase-virtual-path-to-version-I-want-to_compare-to
But when I run that command in cygw...
I'm currently trying to make some small shell-like utility for a custom script I wrote, so I can easily work with it (it's rather simple, so an interactive shell would be perfect).
Do you have any resources for me on how to create a shell in Python? I spent googling for a while, but all I could find was information about IDLE and simila...
I'm writing a cgi-bin program for my Sheevaplug (running the default Ubuntu install) that displays a shell in a browser page. It is a single C program that is placed in the cgi-bin folder and viewed in a browser. It automatically launches a daemon and the daemon forks an instance of the shell. The cgi-bin communicates with the daemon via...
David Korn, a proponent of the Unix philosophy, chided Perl programmers a few years ago in a Slashdot interview for writing monolithic Perl scripts without making use of the Unix toolkit through pipes, redirection, etc. "Unix is not just an operating system," he said, "it is a way of doing things, and the shell plays a key role by provid...
I am using code similar to the below to add some files to a zip folder:
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(CVar(strDest)).CopyHere CVar(strSource)
This works fine most of the time, but sometimes I get an error:
"(Compressed (zipped) Folders Error) Cannot create output file". This error is raised asynchronousl...