How to handle missing args in shell script
What's the "right" way to handle missing arguments in a shell script? Is there a pre-canned way to check for this and then throw an exception? I'm an absolute beginner. ...
What's the "right" way to handle missing arguments in a shell script? Is there a pre-canned way to check for this and then throw an exception? I'm an absolute beginner. ...
I have written a shell script with a switch case and takes in options 1-5 and performs operations on the variables accordingly. My code works fine though theres a small change I would like to make in my code. When the code Enters the default case argument,after that it still prompts for "Enter two numbers: " and then prints "Invalid Op...
Hi I have a ton of data in multiple csv files and filter out a data set using grep: user@machine:~/$ cat data.csv | grep -a "63[789]\...;" 637.05;1450.2 637.32;1448.7 637.60;1447.7 637.87;1451.5 638.14;1454.2 638.41;1448.6 638.69;1445.8 638.96;1440.0 639.23;1431.9 639.50;1428.8 639.77;1427.3 I want to figure out the data set which has...
i have my shell code: #!/bin/sh if [ ! -d $1 ] then echo $1 nu este director exit1 fi ls -R $1 >temp permission= ls -al $1 | cut -d" " -f1 for i in `cat temp` do perm= ls -l $i | cut -d" " -f1 if [ $permission -ne $perm ] then n=`expr $n + 1` fi echo $n done and my statement which sounds like this:for an folder given...
Im a new to Unix shell scripting .I have to write a Unix script A) To find a files in a particular directory which has got csv as well .txt B) Compress those files both csv and txt c)currently under that have not been modified in 1095 days d)Send a mail to the receipent Kindly help me ...
Hi Everyone, I have a bash shell script that requires ctrl-D to break out of the terminal.can anyone tell me how to use it in the shell script example ssh host last --->displays the list of users who were logged on to that host i have different hosts the output is appended to one final and when i'm executing this particular shell s...
Hi all, i want to run a program via script. normally i type ./program in the shell and the program starts. my script looks like this: #!/bin/sh cd /home/user/path_to_the_program/ sh program it fails, i think the last line went wrong... i know this is childish question but thx a lot! ...
let me start off with what I need; the program is given a directory, it will then examine all the files in the directory (works) and do stuff to the files (waiting till it can find all the files for this part). then it will look for subdirectories and re-run its self for each subdirectory. the directory I'm testing with looks like this:...
I have a data set that looks like the following: movie (year) genre for example. some words (1934) action My goal is to grab each "movie" field and then check a different file that also has a bunch of movies and delete the lines from the second file that do not contain the movie. I have been trying to use awk to do this, but have o...
I want create a new launcher in the Application -> Game menu with bash shell. How can I do that ? ...
Following is a source code which takes in only 'files',lists the file permissions of a file and prints the output by replacing r=READ,w-WRITE,x-EXECUTABLE. It should also echo "User".But the My problem here is that I have replaced '-' by User but then if the file has a permission of r--x,it also prints "User" @ that point.I know its n...
Hey Guys, I have a simple script ... dir=`pwd` echo $dir cd ./selenium-grid-1.0.8/ CMD="ant -Dport=$1 -Dhost=$2 -DhubURL=http://172.16.1.137:4444 -Denvironment="$3"-DseleniumArgs="-firefoxProfileTemplate C:/software/rc_user_ffprofile -multiWindow" launch-remote-control" echo $CMD $CMD 2>&1 #End Whenever i run this command, i get: ...
Please resist the urge to tell me not to use c-shell. I'm writing a c-shell script and I need to run a diff between two files (generated in the script). How do I run diff and return its status (if it fails, return 1, else 0)? ...
Suppose I have this sentence: My name is bob. And I want to copy the word "is" from that sentence into a variable. How would I access that word, without knowing in advance the word I am looking for? If I know a specific word or string is in the third column of text in a five column text line, how can I take the word in the third colu...
hey there, I have a question regarding picture scaling. I have an application where users are able to upload pictures in albums but naturally the uploaded images need to be resized so there are also thumbs available and the shown pictures also fit in the page (eg. 800x600). The way I do the resize is like this: Image scaledImag...
I want to parse a log file (log.txt) which contains rows similar to these: 2010-10-19 07:56:14 URL:http://www.website.com/page.php?ID=26 [13676] -> "www.website.com/page.php?ID=26" [1] 2010-10-19 07:56:14 URL:http://www.website.com/page.php?ID=44 [14152] -> "www.website.com/page.php?ID=44" [1] 2010-10-19 07:56:14 URL:http://www.website....
Hi Everyone, I have a shell script written in bash and this script should take file as an argument,can any one tell me how to write script for this any ideas on this are apprecited Thanks, ...
Hi, In a script I'd like to monitor the process list in a way that, in order to continue the execution of the script, a certain process has to be started. I came up with something like: while ! pgrep "process_to_match" do sleep 10 done; # the rest of the script The problem with that script is that if the "process_to_match" is sta...
I need to see all files (with full pathname), along with their file permissions, on a folder which DO NOT match -rw-r--r-- This didn't work as I thought it should have: #ls -laR | grep --invert-match '-rw-r--r--' grep: invalid option -- - ...
On a unix system, how do I monitor (like how 'tail' works) a directory for changes made to files - either new ones created, or size changes, etc. Looking for a command line tool rather than something to be installed. ...