Sponsored Content
Full Discussion: Complex if then else
Top Forums Shell Programming and Scripting Complex if then else Post 302847111 by elilmal on Monday 26th of August 2013 10:37:25 AM
Old 08-26-2013
Complex if then else

Code:
for i in $(condition ONE);do for e in $(CONDITION TWO);do

         if [ $i = switch_ports_online1.txt ]; then
                command 1
                command 2
                command 3
         else  if [ $i = switch_ports_online2.txt ]; then
                command 1
                command 2
                command 3
         else  if [ $i = switch_ports_online3.txt ]; then
                command 1
                command 2
                command 3s
         else  if [ $i = switch_ports_online4.txt ]; then
                command 1
                command 2
                command 3
         echo ""
         fi
done;done
cat miofilesss

Hi all
There is a way to not specify every time "switch_ports_online*"?

In this file there is different ports.
Thanks
Luca
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Complex use with awk

Hi , I have file named docs.txt The content of the file look like this: DOC disk location Size ======= ===== ============= ========= TXT A /dev/dm-1 10 TXT B /dev/dm-2 10 BIN C ... (3 Replies)
Discussion started by: yoavbe
3 Replies

2. UNIX for Dummies Questions & Answers

Complex Commands

I need to ideas for some complex commands for a script file. Any ideas would be greatly appricated (2 Replies)
Discussion started by: trob
2 Replies

3. Shell Programming and Scripting

Complex Script

hey... i had a big problem with my professor i have 3 simple archives in.txt -> had all timestamps of users logon (100lines) ex. 111111 222222 333333 out.txt -> had all timestamps of users logof (100lines) ex. 111113 222225 333332 commands.txt... (9 Replies)
Discussion started by: beandj
9 Replies

4. Shell Programming and Scripting

Complex query

A file whose location i am not aware of contains the below text <url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(FAILOVER=on)(ADDRESS=(PROTOCOL=TCP) (HOST=ngm2sn1p2-vip.mybank.net)(PORT=4001))(ADDRESS=(PROTOCOL=TCP)(HOST=ngm2sn2p2-vip.mybank.net)... (1 Reply)
Discussion started by: mohtashims
1 Replies

5. Shell Programming and Scripting

Complex Compare

Hi All, File1.txt File2.txt Above are the two input file's: Always I use to get three rows for File1.txt File1.txt (fixed width) 2nd line i will get date and 3rd record i will get a number. File2.txt (Pile delimeter) will contains 'n' number of records were header & footer is... (4 Replies)
Discussion started by: kmsekhar
4 Replies

6. Shell Programming and Scripting

complex requirement

i have a requirement to search a pattern1 and once the pattern1 is found i have to go up and search pattern2 and if pattern2 is found i have to search down for pattern3 and pattern4. once this cycle is compelted, again i have to search pattern1 and pattern2,3,4 i am able to do this by opening... (9 Replies)
Discussion started by: tnvanathy23
9 Replies

7. Shell Programming and Scripting

Help with Complex Awk.

Hi, I have a file. In this file when ever the word "ABC" occurs at position from 25 and 34 I would like to replace the value at postion 100 to 5 for the first 1000 rows only. I have written the following Awk command. nawk 'substr($0,25,9)=="ABC" {print $0}' filename The above command... (4 Replies)
Discussion started by: pinnacle
4 Replies

8. Shell Programming and Scripting

Complex variable

If I need the output as below, what syntax I should use. I use only korn shell. =========In file =========================== #!/usr/bin/ksn P1=cat P2=dog P3=bat for i 1 2 3 do echo $P$i # <---------- This line is the problem I face. What I should use. done ========= End of file... (5 Replies)
Discussion started by: kkakarot
5 Replies
Mojo::Command(3pm)					User Contributed Perl Documentation					Mojo::Command(3pm)

NAME
Mojo::Command - Command base class SYNOPSIS
# Lower case command name package Mojolicious::Command::mycommand; # Subclass use Mojo::Base 'Mojo::Command'; # Take care of command line options use Getopt::Long 'GetOptions'; # Short description has description => "My first Mojo command. "; # Short usage message has usage => <<"EOF"; usage: $0 mycommand [OPTIONS] These options are available: -s, --something Does something. EOF # <suitable Futurama quote here> sub run { my $self = shift; # Handle options local @ARGV = @_; GetOptions('s|something' => sub { $something = 1 }); # Magic here! :) } DESCRIPTION
Mojo::Command is an abstract base class for Mojo commands. See Mojolicious::Commands for a list of commands that are available by default. ATTRIBUTES
Mojo::Command implements the following attributes. "description" my $description = $command->description; $command = $command->description('Foo!'); Short description of command, used for the command list. "quiet" my $quiet = $command->quiet; $command = $command->quiet(1); Limited command output. "usage" my $usage = $command->usage; $command = $command->usage('Foo!'); Usage information for command, used for the help screen. METHODS
Mojo::Command inherits all methods from Mojo::Base and implements the following new ones. "app" my $app = $command->app; Currently active application. # Introspect say "Template path: $_" for @{$command->app->renderer->paths}; "chmod_file" $command = $command->chmod_file('/home/sri/foo.txt', 0644); Portably change mode of a file. "chmod_rel_file" $command = $command->chmod_rel_file('foo/foo.txt', 0644); Portably change mode of a file relative to the current working directory. "class_to_file" my $file = $command->class_to_file('Foo::Bar'); Convert a class name to a file. Foo::Bar -> foo_bar FOO::Bar -> foobar FooBar -> foo_bar FOOBar -> foobar "class_to_path" my $path = $command->class_to_path('Foo::Bar'); Convert class name to path. Foo::Bar -> Foo/Bar.pm "create_dir" $command = $command->create_dir('/home/sri/foo/bar'); Portably create a directory. "create_rel_dir" $command = $command->create_rel_dir('foo/bar/baz'); Portably create a directory relative to the current working directory. "get_all_data" my $all = $command->get_all_data; my $all = $command->get_all_data('Some::Class'); Extract all embedded files from the "DATA" section of a class. "get_data" my $data = $command->get_data('foo_bar'); my $data = $command->get_data('foo_bar', 'Some::Class'); Extract embedded file from the "DATA" section of a class. "help" $command->help; Print usage information for command. "rel_dir" my $path = $command->rel_dir('foo/bar'); Portably generate an absolute path for a directory relative to the current working directory. "rel_file" my $path = $command->rel_file('foo/bar.txt'); Portably generate an absolute path for a file relative to the current working directory. "render_data" my $data = $command->render_data('foo_bar', @args); Render a template from the "DATA" section of the command class. "render_to_file" $command = $command->render_to_file('foo_bar', '/home/sri/foo.txt'); Render a template from the "DATA" section of the command class to a file. "render_to_rel_file" $command = $command->render_to_rel_file('foo_bar', 'foo/bar.txt'); Portably render a template from the "DATA" section of the command class to a file relative to the current working directory. "run" $command->run; $command->run(@ARGV); Run command. Meant to be overloaded in a subclass. "write_file" $command = $command->write_file('/home/sri/foo.txt', 'Hello World!'); Portably write text to a file. "write_rel_file" $command = $command->write_rel_file('foo/bar.txt', 'Hello World!'); Portably write text to a file relative to the current working directory. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Command(3pm)
All times are GMT -4. The time now is 12:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy