Sponsored Content
Full Discussion: add or modify if existent
Top Forums Shell Programming and Scripting add or modify if existent Post 302112410 by radoulov on Wednesday 28th of March 2007 03:28:27 AM
Old 03-28-2007
Quote:
Originally Posted by melanie_pfefer
I want to set these params in /etc/system

set shmsys:shminfo_shmmax=2000000000
set shmseg:shminfo_shmseg=200


if this param exists, then I want to modify them
if not, I want to add them.

I can add them using >>/etc/system
but how to do the modify thing?
at least I can comment the existing lines -if existent- and then add the 2 entries.
Code:
cat<<! >tmp && mv tmp /etc/system
$(egrep -v "^set (shmsys:shminfo_shmmax|shmseg:shminfo_shmseg)" /etc/system)
$(printf "set shmsys:%s\nset shmseg:%s\n" "shminfo_shmmax=2000000000" "shminfo_shmseg=200")
!

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how can i add/modify filename after output?

Hi All, I have a script to convert a file and output the filename with "_output", however it not work. Can help? echo Please input list file name: read listn for file in `cat $listn.txt` do convert $file > $file_output Thanks all!! (3 Replies)
Discussion started by: happyv
3 Replies

2. Shell Programming and Scripting

Checking for future / non existent dates

'm attempting to script an application for the bash shell. The application needs to check for birthday, but must check the birthday to see if the date is a) in the future b) exists at all (ie Feb 29th during non-leap years). The input is being entered in a YYYYMMDD format, so I was hoping someone... (2 Replies)
Discussion started by: DKNUCKLES
2 Replies

3. Shell Programming and Scripting

Help with search and delete/add/modify script

Gurus, I need to run a script on multiple XML files in different directories and do the following (the output can be redirected to create a new file) 1. Search a pattern like "abc.mno.xyz" in an XML file, once detected, the script should delete one line above and 3 lines below (including the... (2 Replies)
Discussion started by: inditopgun
2 Replies

4. Shell Programming and Scripting

Creating a directory if its non-existent within a script

Hi, is there a way to create a directory when its non-existent when trying to move files to this particular folder? Thanks much. (7 Replies)
Discussion started by: ida1215
7 Replies

5. Shell Programming and Scripting

Modify a file by another file: add new line and variable after string is found

hello, I have problem with writing/adjusting a shell script. I searched forum and unfortunately couldn't write scipt based on the information I found. I never wtire such so it's hard for me and I do need to modify one script immediately. case looks like: 1. 'file' that needs to be modified... (3 Replies)
Discussion started by: bipbip
3 Replies

6. Shell Programming and Scripting

Create a directory when its non-existent

Hi I need to create a directory when its non-existent Having an issue with the code here because it doesn't work can someone point what and how to change, please. ---------- Post updated at 11:08 AM ---------- Previous update was at 11:07 AM ---------- filelist=project_name/files/... (7 Replies)
Discussion started by: murari83.ds
7 Replies

7. Shell Programming and Scripting

Please modify solution

Hi Please check my code,here awk -vLIT="$line" '$0 ~ LIT { print LIT,"Found in ",FILENAME; }' $f it is not checking for small alphabets.can u pls modify my code #!/bin/ksh for f in /tmp/satemp/* do cat /tmp/sa/tt.txt| while read line do awk -vLIT="$line" '$0 ~ LIT { print LIT,"Found in... (3 Replies)
Discussion started by: coolboy98699
3 Replies

8. Red Hat

Postfix - want to send email to some non-existent user using alias

Hi, I know how to use email redirection using /etc/aliases file + postfix combination and it is working fine for existing users. The question I have is: I want to send an email to tony@server1.example.com while tony user is actually not there. Rather, I want to redirect that email to... (0 Replies)
Discussion started by: freebird8z
0 Replies

9. Shell Programming and Scripting

Shebang of non-existent interpreter not giving error

I read that whenever you provide wrong path at sha-bang it will generate an error with message "command not found", but when I run script with wrong path, it runs perfectly without generating any error. any reason ? #!/home/usrname/etc echo "hello" exit 0 (4 Replies)
Discussion started by: Qazi
4 Replies

10. Shell Programming and Scripting

File modify

Hi All I am getting a file with below pattern - 00150366 05/08/2015 07:14:32 8000186167+++ 50195281000000000371001010903236 800186167+++ 100209000000000 800000018617+++ 50295281000000000371001010900217================================3u4398482344334=432434 00150367 05/08/2015 07:14:32... (7 Replies)
Discussion started by: honey26
7 Replies
HTML::Template::Pluggable(3pm)				User Contributed Perl Documentation			    HTML::Template::Pluggable(3pm)

NAME
HTML::Template::Pluggable - Extends HTML::Template with plugin support SYNOPSIS
Just use this module instead of HTML::Template, then use any plugins, and go on with life. use HTML::Template::Pluggable; use HTML::Template::Plugin::Dot; # Everything works the same, except for functionality that plugins add. my $t = HTML::Template::Pluggable->new(); THE GOAL
Ideally we'd like to see this functionality merged into HTML::Template, and turn this into a null sub-class. STATUS
The design of the plugin system is still in progress. Right now we have just two triggers, in param and output. The name and function of this may change, and we would like to add triggers in new() and other methods when the need arises. All we promise for now is to keep HTML::Template::Plugin::Dot compatible. Please get in touch if you have suggestions with feedback on designing the plugin system if you would like to contribute. WRITING PLUGINS
HTML::Template offers a plugin system which allows developers to extend the functionality in significant ways without creating a creating a sub-class, which might be impossible to use in combination with another sub-class extension. Currently, two triggers have been made available to alter how the values of TMPL_VARs are set. If more hooks are needed to implement your own plugin idea, it may be feasible to add them-- check the FAQ then ask about it on the list. Class::Trigger is used to provide plugins. Basically, you can just: HTML::Template->add_trigger('middle_param', &trigger); A good place to add one is in your plugin's "import" subroutine: package HTML::Template::Plugin::MyPlugin; use base 'Exporter'; sub import { HTML::Template->add_trigger('middle_param', &dot_notation); goto &Exporter::import; } TRIGGER LOCATIONS param We have added one trigger location to this method, named "middle_param". # in a Plugin's import() routine. HTML::Template->add_trigger('middle_param', &_set_tmpl_var_with_dot ); This sets a callback which is executed in param() with all of the same arguments. It is only useful for altering how /setting/ params works. The logic to read a param is unaffected. It can set any TMPL_VAR values before the normal param logic kicks in. To do this, "$self->{param_map}" is modified as can be seen from source in HTML::Template::param(). However, it must obey the following convention of setting $self->{param_map_done}{$param_name} for each param that is set. $param_name would be a key from "$self->{param_map}". This notifies the other plugins and the core param() routine to skip trying to set this value. $self->{param_map_done} is reset with each call to param(), so that like with a hash, you have the option to reset a param later with the same name. output One trigger location here: "before_output". HTML::Template->add_trigger('before_output', &_last_chance_params ); This sets a callback which is executed right before output is generated. SEE ALSO
o HTML::Template::Plugin::Dot - Add Template Toolkit's magic dot notation to HTML::Template. AUTHOR
Mark Stosberg, "<mark@summersault.com>" BUGS
Please report any bugs or feature requests to "bug-html-template-pluggable@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Copyright &; License Copyright 2006 Mark Stosberg, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2011-01-04 HTML::Template::Pluggable(3pm)
All times are GMT -4. The time now is 12:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy