Sponsored Content
Top Forums Shell Programming and Scripting Shell script to check numbers! Post 302366874 by frans on Friday 30th of October 2009 03:28:33 PM
Old 10-30-2009
using if and [] expansion

Code:
if [[ "${FILENAME:0:1}" = [Ii] ]]
then do something
elif [[ "${FILENAME:0:1}" = [Mm] ]]
then do something
elif [[ "${FILENAME:0:1}" = [Pp] ]]
then do something
fi

but using case is cleaner.
Or explain more precisely what you want to do, maybe one can find the optimal code for doing so.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

retain Line numbers.. in Vi .. OR .. A SHELL SCRIPT

Hello everybody ! GOT SOMETHING INTERESTING... I am trying to retain line number for a text document.. usually we get line numbers in VI using :set nu , but I want to permanently store them. It's a 4000 lines of text and I want grep/search it for a list of words/fields stored in a different... (2 Replies)
Discussion started by: sdlayeeq
2 Replies

2. Shell Programming and Scripting

add numbers in shell script

cat dailyreports | grep "Important list" | awk -F":" '{print $2}' | awk -F" " '{print $1}' hey guys, after running the above combination of cat and awk, i get the below output: 3 4 2 9 now, i need to add these numbers up all in one line. i dont know what to add to that cat and awk one... (2 Replies)
Discussion started by: Terrible
2 Replies

3. Shell Programming and Scripting

Shell script to check the unique numbers in huge data

Friends, I have to write a shell script,the description is---- i Have to check the uniqueness of the numbers in a file. A file is containing 200thousand tickets and a ticket have 15 numbers in asecending order.And there is a strip that is having 6 tickets that means 90 numbers.I... (7 Replies)
Discussion started by: namishtiwari
7 Replies

4. Shell Programming and Scripting

Shell script to search through numbers and print the output

Suppose u have a file like 1 30 ABCSAAHSNJQJALBALMKAANKAMLAMALK 4562676268836826826868268468368282972982 2863923792102370179372012792701739729291 31 60... (8 Replies)
Discussion started by: cdfd123
8 Replies

5. Shell Programming and Scripting

reverse ':' separated numbers in a shell script

I want to reverse a the following: 00:11:22:33:44:55 I currently use something like below to pass it as is. But now I want the same script to reverse the above and pass it to ethtool. // psuedo code i=0 skip=0 for m in $@ do if then skip=1 ... (1 Reply)
Discussion started by: bhanu.nani
1 Replies

6. Shell Programming and Scripting

How to compare floating point numbers in shell script?

How can we compare 2 floating point numbers in SHELL script? (11 Replies)
Discussion started by: dearanik
11 Replies

7. Shell Programming and Scripting

Shell script to find the sum of first n Fibonacci numbers

pls give me the solution for this i need it for my exam pls pls pls Shell script to find the sum of first n Fibonacci numbers (1 Reply)
Discussion started by: Kshitija
1 Replies

8. Shell Programming and Scripting

calculation using awk or shell script in between the numbers

file A E969K D223L E400L E34L file B predicted 3 1 250 251 500 501 1000 The output should be E969K 501 1000 D223L 1 250 E400L 251 500 E34L 1 250 I tried in this way (1 Reply)
Discussion started by: cdfd123
1 Replies

9. Shell Programming and Scripting

Script Shell: Count The sum of numbers in a file

Hi all; Here is my file: V1.3=4 V1.4=5 V1.1=3 V1.2=6 V1.3=6 Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ? Thank you so much for help. Kind regards. (3 Replies)
Discussion started by: chercheur111
3 Replies

10. UNIX for Beginners Questions & Answers

Shell script to tail a file with unknown numbers

Hello, I would like to write script to tail a file for different environment But the number of lines are keep changing How can I write a script For example: env could : A, B or C and log files could be a.log, b.log and c.log with the number of lines can change say sometimes it 100 last... (9 Replies)
Discussion started by: encrypt_decrypt
9 Replies
HOBBITLAUNCH(8) 					      System Manager's Manual						   HOBBITLAUNCH(8)

NAME
hobbitlaunch - Master program to launch other Xymon programs SYNOPSIS
hobbitlaunch [options] DESCRIPTION
hobbitlaunch(8) is the main program that controls the execution and scheduling of all of the components in the Xymon system. hobbitlaunch allows the administrator to add, remove or change the set of Xymon applications and extensions without restarting Xymon - hob- bitlaunch will automatically notice any changes in the set of tasks, and change the scheduling of activities accordingly. hobbitlaunch also allows the administrator to setup specific logfiles for each component of the Xymon system, instead of getting output from all components logged to a single file. OPTIONS
--env=FILENAME Loads the environment from FILENAME before starting other tools. The environment defined by FILENAME is the default, it can be overridden by the ENVFILE option in hobbitlaunch.cfg(5) --config=FILENAME This option defines the file that hobbitlaunch scans for tasks it must launch. A description of this file is in hobbitlaunch.cfg(5) The default tasklist is /etc/hobbitlaunch.cfg --log=FILENAME Defines the logfile where hobbitlaunch logs information about failures to launch tasks and other data about the operation of hobbit- launch. Logs from individual tasks are defined in the hobbitlaunch.cfg file. By default this is logged to stdout. --pidfile=FILENAME Filename which hobbitlaunch saves its own process-ID to. Commonly used by automated start/stop scripts. --verbose Logs the launch of all tasks to the logfile. Note that the logfile may become quite large if you enable this. --dump Just dump the contents of the hobbitlaunch.cfg file after parsing it. Used for debugging. --debug Enable debugging output while running. --no-daemon hobbitlaunch normally detaches from the controlling tty and runs as a background task. This option keeps it running in the fore- ground. STARTING TASKS
hobbitlaunch will read the configuration file and start all of the tasks listed there. If a task completes abnormally (i.e. terminated by a signal or with a non-zero exit status), then hobbitlaunch will attempt to restart it 5 times. If it still will not run, then the task is disabled for 10 minutes. This will be logged to the hobbitlaunch logfile. If the configuration file changes, hobbitlaunch will re-read it and notice any changes. If a running task was removed from the configura- tion, then the task is stopped. If a new task was added, it will be started. If the command used for a task changed, or it was given a new environment definition file, or the logfile was changed, then the task is stopped and restarted with the new definition. SEE ALSO
hobbitlaunch.cfg(5), xymon(7) Xymon Version 4.2.3: 4 Feb 2009 HOBBITLAUNCH(8)
All times are GMT -4. The time now is 12:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy