Sponsored Content
Full Discussion: Bash shell script help
Top Forums UNIX for Beginners Questions & Answers Bash shell script help Post 303044028 by RudiC on Wednesday 12th of February 2020 05:47:14 PM
Old 02-12-2020
Any attempts / ideas / thoughts from your side?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

need help with bash shell script

Hi guys! I have just started with shell programming!! I am having pronblem with variable subsitutuion. when i do egrep "*" marks this will give me the pattern match. but how can i catch the output of that result in a variable. if i say result = egrep "*" marks it gives me syntax... (2 Replies)
Discussion started by: vmtailor
2 Replies

2. UNIX for Dummies Questions & Answers

Bash shell script

Hi Guys, I am trying to alter a script for my company. I need the start of it to go something like this. User is asked to input 8 numbers 8 numbers are written to a txt file ***** ***** ***** txt file is read ***** ***** The text file gets read in between other files represented by... (2 Replies)
Discussion started by: outthere_3
2 Replies

3. Shell Programming and Scripting

Bash Shell script--need help

Hi all, i am beginner to unix and trying out a shell script which does the following. i have to calculate a persons salary. his salary is read from the keyboard. he has two types of deductions. 40% as dearness allowance and 20% as house rent. i have to print the gross salary. here is the code... (5 Replies)
Discussion started by: Irishboy24
5 Replies

4. Shell Programming and Scripting

Bash shell script- help

I need to invoke a program on remote server using ssh in a shell script. In addition i would like to capture date/time and if there is any errors , then script should write to log file. can someone please help me out? (1 Reply)
Discussion started by: sam101
1 Replies

5. Shell Programming and Scripting

Help with bash shell script

Hi, I have a file in which records contains non ascii characters. The records are comma delimited and quoted. The non ascii characters are found in a particular column. Example records "YY","AK000021","Ã","IO","PP" "Y1","AK000022","Ã","PO","PP" "Y2","AK000022","Ã","PO","PP" I need to... (2 Replies)
Discussion started by: akshu.agni
2 Replies

6. Shell Programming and Scripting

Bash Shell Script

HELP!My program ends after entering one choice---need help making it take multiple inputs,instead of terminating after displaying just one #!/bin/bash# Crude address databaseclear # Clear the screen.echo " Contact List"echo " ------- ----"echo "Choose one of the following... (6 Replies)
Discussion started by: help123
6 Replies

7. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

8. Shell Programming and Scripting

Need help with bash shell script

I need to create digit day script that takes a single numeric argument and then it should print out the day of the week using the number modulo 7 formula e.g: 0 - Sunday 6- Saturday 131 - Friday I am fairly new to unix so I don't know how to use the number modulo 7 formula. Does the script need... (3 Replies)
Discussion started by: lukefrost96
3 Replies

9. Shell Programming and Scripting

Different behavior between bash shell and bash script for cmd

So I'm trying to pass certain json elements as env vars and use them later on in a script. Sample json: JSON='{ "Element1": "file-123456", "Element2": "Name, of, company written in, a very weird way", "Element3": "path/to/some/file.txt", }' (part of the) script: for s... (5 Replies)
Discussion started by: da1
5 Replies

10. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ? --- Post updated at 08:39 AM --- in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies
MooseX::Role::Parameterized(3)				User Contributed Perl Documentation			    MooseX::Role::Parameterized(3)

NAME
MooseX::Role::Parameterized - roles with composition parameters SYNOPSIS
package Counter; use MooseX::Role::Parameterized; parameter name => ( isa => 'Str', required => 1, ); role { my $p = shift; my $name = $p->name; has $name => ( is => 'rw', isa => 'Int', default => 0, ); method "increment_$name" => sub { my $self = shift; $self->$name($self->$name + 1); }; method "reset_$name" => sub { my $self = shift; $self->$name(0); }; }; package MyGame::Weapon; use Moose; with Counter => { name => 'enchantment' }; package MyGame::Wand; use Moose; with Counter => { name => 'zapped' }; MooseX::Role::Parameterized::Tutorial Stop! If you're new here, please read MooseX::Role::Parameterized::Tutorial for a much gentler introduction. DESCRIPTION
Your parameterized role consists of two new things: parameter declarations and a "role" block. Parameters are declared using the "parameter" keyword which very much resembles "has" in Moose. You can use any option that "has" in Moose accepts. The default value for the "is" option is "ro" as that's a very common case. Use "is => 'bare'" if you want no accessor. These parameters will get their values when the consuming class (or role) uses "with" in Moose. A parameter object will be constructed with these values, and passed to the "role" block. The "role" block then uses the usual Moose::Role keywords to build up a role. You can shift off the parameter object to inspect what the consuming class provided as parameters. You use the parameters to customize your role however you wish. There are many possible implementations for parameterized roles (hopefully with a consistent enough API); I believe this to be the easiest and most flexible design. Coincidentally, Pugs originally had an eerily similar design. See MooseX::Role::Parameterized::Extending for some tips on how to extend this module. Why a parameters object? I've been asked several times "Why use a parameter object and not just a parameter hashref? That would eliminate the need to explicitly declare your parameters." The benefits of using an object are similar to the benefits of using Moose. You get an easy way to specify lazy defaults, type constraint, delegation, and so on. You get to use MooseX modules. You also get the usual introspective and intercessory abilities that come standard with the metaobject protocol. Ambitious users should be able to add traits to the parameters metaclass to further customize behavior. Please let me know if you're doing anything viciously complicated with this extension. :) CAVEATS
You must use this syntax to declare methods in the role block: "method NAME => sub { ... };". This is due to a limitation in Perl. In return though you can use parameters in your methods! AUTHOR
Shawn M Moore, "sartak@gmail.com" SEE ALSO
http://sartak.org/2009/01/parametric-roles-in-perl-5.html <http://sartak.org/2009/01/parametric-roles-in-perl-5.html> http://sartak.org/2009/05/the-design-of-parameterized-roles.html <http://sartak.org/2009/05/the-design-of-parameterized-roles.html> http://stevan-little.blogspot.com/2009/07/thoughts-on-parameterized-roles.html <http://stevan-little.blogspot.com/2009/07/thoughts-on- parameterized-roles.html> <http://perldition.org/articles/Parameterized%20Roles%20with%20MooseX::Declare.pod> http://www.modernperlbooks.com/mt/2011/01/the-parametric-role-of-my-mvc-plugin-system.html <http://www.modernperlbooks.com/mt/2011/01/the- parametric-role-of-my-mvc-plugin-system.html> http://jjnapiorkowski.typepad.com/modern-perl/2010/08/parameterized-roles-and-method-traits-redo.html <http://jjnapiorkowski.typepad.com/modern-perl/2010/08/parameterized-roles-and-method-traits-redo.html> http://sartak.org/talks/yapc-asia-2009/(parameterized)-roles/ <http://sartak.org/talks/yapc-asia-2009/(parameterized)-roles/> https://github.com/SamuraiJack/JooseX-Role-Parameterized <https://github.com/SamuraiJack/JooseX-Role-Parameterized> - this extension ported to JavaScript's Joose COPYRIGHT AND LICENSE
Copyright 2007-2010 Infinity Interactive This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-01-12 MooseX::Role::Parameterized(3)
All times are GMT -4. The time now is 08:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy