Sponsored Content
Top Forums Shell Programming and Scripting Use parameter expansion over a parameter expansion in bash. Post 303043430 by MadeInGermany on Tuesday 28th of January 2020 12:34:06 PM
Old 01-28-2020
Really interesting. By definition it is a variable modifier that means the LHS must be a variable. Nesting can only be attempted on the RHS that is a string.
Apparently in zsh the LHS can be a string that means it is a full functional operator.
This User Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

removing html tags via parameter expansion

Hi all- I have a variable that contains a web page: echo $STUFF <html> <head> <title>my page</title></head> <body> blah blah etc.. Can I use the shell's parameter expansion abilities to remove just the tags? I thought that FIXHTML=${STUFF//<*>/} might do it, but it didn't seem to... (2 Replies)
Discussion started by: rev66
2 Replies

2. Shell Programming and Scripting

Need to print the expansion of the found string (the expansion is beween two delimiters '-' , '||'

Hi , could anyone help me out with this problem. sample.txt has this content : u001- this is used for project1 || u002- this is used for p2|| not to be printed u003- this is used for project3 || u004- this is used for p4 || u005- this is used for project5 || u006- this is used for p6... (9 Replies)
Discussion started by: Balaji PK
9 Replies

3. Shell Programming and Scripting

Need help with parameter expansion

Say you have this numeric variable that can be set by the user but you never want it to leave a certain range when it gets printed. How could you use parameter expansion such that it will never expand outside of that boundary? Thanks ---------- Post updated at 11:09 PM ---------- Previous update... (3 Replies)
Discussion started by: stevenswj
3 Replies

4. Shell Programming and Scripting

Bash parameter expansion from a config file

Hi - I am trying to do a simple config file with known variable names in it, e.g.: contents of config file a.conf: -a -b $work -c $host simplified contents of bash script file: work='trunk' host='alaska' opts=$(tr '\n' ' ' < a.conf) opts="$opts $*" mycommand $opts arg1 arg2 The... (3 Replies)
Discussion started by: mrengert
3 Replies

5. Shell Programming and Scripting

Parameter expansion not working for all strings...

I'm trying to write a script that parses my music collection and hard link some filenames that my media player doesn't like to other names. To do this I need to extract the name and remove alla non ASCII characters from that and do a cp -l with the result. Problem is this: 22:16:58 $... (8 Replies)
Discussion started by: refuser
8 Replies

6. UNIX for Dummies Questions & Answers

Parameter Expansion with regular expression

Hello experts, I am exploring parameter expansion, and trying to cut the fields in a URL. Following is the requirement: I have // abc.nnt /dir1/dir2/dir3/dir4/somefile.java What i need to get is the path after dir3, and dir3 will be passed. output that i need is... (1 Reply)
Discussion started by: gjarms
1 Replies

7. Shell Programming and Scripting

Bash Parameter Expansion

I have made the following examples that print various parameter expansions text: iv-hhz-sac/hpac/hhz.d/iv.hpac..hhz.d.2016.250.070018.sac (text%.*): iv-hhz-sac/hpac/hhz.d/iv.hpac..hhz.d.2016.250.070018 (text%%.*): iv-hhz-sac/hpac/hhz (text#*.): d/iv.hpac..hhz.d.2016.250.070018.sac... (2 Replies)
Discussion started by: kristinu
2 Replies

8. Shell Programming and Scripting

Bash Parameter Expansion

#!/bin/bash SNMPW='/usr/bin/snmpwalk' while read h i do loc=$($SNMPW -v3 -u 'Myusername' -l authPriv -a SHA -A 'Password1' -x AES -X 'Password2' $i sysLocation.0 2>/dev/null) loc=${loc:-" is not snmpable."} loc=${loc##*: } loc=${loc//,/} echo "$i,$h,$loc" done < $1 My question is ... ... (1 Reply)
Discussion started by: sumguy
1 Replies

9. Shell Programming and Scripting

Bash : More parameter expansion and IFS

I am trying to become more fluent with the interworking of bash and minimize the number of external calls. Sample Data. This will be the response of the snmp query. SNMPv2-MIB::sysName.0 = STRING: SomeHostName SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1.1745... (5 Replies)
Discussion started by: sumguy
5 Replies

10. Shell Programming and Scripting

Bash : Parameter expansion ${var:-file*}

Example data $ ls *somehost* 10.10.10.10_somehost1.xyz.com.log 11.11.11.11_somehost2.xyz.com.log #!/bin/bash #FILES="*.log" FILES=${FILES:-*.log} for x in $FILES do ip="${x%%_*}" # isolate IP address x="${x##*_}" # isolate hostname hnam="${x%.*}" # Remove the ".log"... (2 Replies)
Discussion started by: popeye
2 Replies
Mail::SPF::Mod(3)					User Contributed Perl Documentation					 Mail::SPF::Mod(3)

NAME
Mail::SPF::Mod - SPF record modifier base class DESCRIPTION
An object of class Mail::SPF::Mod represents a modifier within an SPF record. Mail::SPF::Mod cannot be instantiated directly. Create an instance of a concrete sub-class instead. Constructors The following constructors are provided: new(%options): returns Mail::SPF::Mod Abstract. Creates a new SPF record modifier object. %options is a list of key/value pairs representing any of the following options: text A string denoting the unparsed text of the modifier. name A string denoting the name of the modifier. Required if a generic Mail::SPF::Mod object (as opposed to a specific sub-class) is being constructed. domain_spec Either a plain string or a Mail::SPF::MacroString object denoting an optional "domain-spec" parameter of the mechanism. new_from_string($text, %options): returns Mail::SPF::Mod; throws Mail::SPF::ENothingToParse, Mail::SPF::EInvalidMod Abstract. Creates a new SPF record modifier object by parsing the string and any options given. Class methods The following class methods are provided: name_pattern: returns Regexp Returns a regular expression that matches any legal modifier name. Instance methods The following instance methods are provided: text: returns string; throws Mail::SPF::ENoUnparsedText Returns the unparsed text of the modifier. Throws a Mail::SPF::ENoUnparsedText exception if the modifier was created synthetically instead of being parsed, and no text was provided. name: returns string Returns the name of the modifier. params: returns string Abstract. Returns the modifier's parameters formatted as a string. A sub-class of Mail::SPF::Mod does not have to implement this method if it supports no parameters, although this is highly unlikely. stringify: returns string Formats the modifier's name and parameters as a string and returns it. You can simply use a Mail::SPF::Mod object as a string for the same effect, see "OVERLOADING". process: throws Mail::SPF::Result, Mail::SPF::Result::Error, Mail::SPF::Exception Abstract. Processes the modifier. What that means depends on the actual implementation in sub-classes. See "MODIFIER TYPES" below. This method is abstract and must be implemented by sub-classes of Mail::SPF::Mod. MODIFIER TYPES
There are different basic types of modifiers, which are described below. All of them are provided by the Mail::SPF::Mod module. Global modifiers - Mail::SPF::GlobalMod SPFv1 (RFC 4408) only knows "global" modifiers. A global modifier may appear anywhere in an SPF record, but only once. During evaluation of the record, global modifiers are processed after the last mechanism has been evaluated and an SPF result has been determined. The following additional class method is provided by Mail::SPF::GlobalMod: precedence: returns real Abstract. Returns a real number between 0 and 1 denoting the precedence of the type of the global modifier. Global modifiers present in an SPF record are processed in the order of their precedence values, 0 meaning "first". This method is abstract and must be implemented by sub-classes of Mail::SPF::GlobalMod. The following specific instance method is provided by Mail::SPF::GlobalMod: process($server, $request, $result): throws Mail::SPF::Result Abstract. Processes the modifier. What that means depends on the actual implementation in sub-classes. Takes both a Mail::SPF::Server and a Mail::SPF::Request object. As global modifiers are generally processed after an SPF result has already been determined, takes also the current Mail::SPF::Result. If the modifier wishes to modify the SPF result, it may throw a different Mail::SPF::Result object. This method is abstract and must be implemented by sub-classes of Mail::SPF::GlobalMod. Positional modifiers - Mail::SPF::PositionalMod Sender ID (RFC 4406) introduces the concept of "positional" modifiers. According to RFC 4406, a positional modifier must follow a mechanism and applies to that, and only that, mechanism. However, because this definition is not very useful, and because no positional modifiers have been defined based on it as of yet, Mail::SPF deviates from RFC 4406 as follows: A positional modifier may appear anywhere in an SPF record, and it is stateful, i.e. it applies to all mechanisms and modifiers that follow it. Positional modifiers are generally multiple, i.e. they may appear any number of times throughout the record. During evaluation of the record, positional modifiers are processed at exactly the time when they are encountered by the evaluator. Consequently, all positional modifiers are processed before an SPF result is determined. The following specific instance method is provided by Mail::SPF::PositionalMod: process($server, $request): throws Mail::SPF::Result::Error, Mail::SPF::Exception Abstract. Processes the modifier. What that means depends on the actual implementation in sub-classes. Takes both a Mail::SPF::Server and a Mail::SPF::Request object. As global modifiers are generally processed before an SPF result has been determined, no result object is available to the modifier. The modifier can (at least at this time) not directly modify the final SPF result, however it may throw an exception to signal an error condition. This method is abstract and must be implemented by sub-classes of Mail::SPF::PositionalMod. Unknown modifiers - Mail::SPF::UnknownMod Both SPFv1 and Sender ID allow unknown modifiers to appear in SPF records in order to allow new modifiers to be introduced without breaking existing implementations. Obviously, unknown modifiers are neither global nor positional, but they may appear any number of times throughout the record and are simply ignored during evaluation of the record. Also obviously, Mail::SPF::UnknownMod does not support a "process" method. The following specific instance method is provided by Mail::SPF::UnknownMod: params: returns string Returns the modifier's unparsed value as a string. OVERLOADING
If a Mail::SPF::Mod object is used as a string, the "stringify" method is used to convert the object into a string. SEE ALSO
Mail::SPF::Mod::Redirect, Mail::SPF::Mod::Exp Mail::SPF, Mail::SPF::Record, Mail::SPF::Term <http://www.ietf.org/rfc/rfc4408.txt> For availability, support, and license information, see the README file included with Mail::SPF. AUTHORS
Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org> perl v5.12.1 2010-07-05 Mail::SPF::Mod(3)
All times are GMT -4. The time now is 09:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy