Sponsored Content
Top Forums Shell Programming and Scripting Bash parameter expansion from a config file Post 302515603 by Corona688 on Wednesday 20th of April 2011 01:16:38 PM
Old 04-20-2011
Quote:
However you did give me an idea which does work (and I think does not have security issues)...
It still has security issues. Anything in $(brackets) or `backticks`, eval will try to execute.
 

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 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. UNIX for Beginners Questions & Answers

How to Grep second word in config file using parameter?

Currently i am building one script to grep region records in the config file based on parameter and then i am creating a text file with that out put and i am reading the source file path in that out put file now i need to pass one more parameter like module based upon that it has to create a... (1 Reply)
Discussion started by: saranath
1 Replies

9. 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

10. Shell Programming and Scripting

Use parameter expansion over a parameter expansion in bash.

Hello All, Could you please do help me here as I would like to perform parameter expansion in shell over a parameter expansion. Let's say I have following variable. path="/var/talend/nat/cdc" Now to get only nat I could do following. path1="${path%/*}" path1="${path1##*/}" Here... (8 Replies)
Discussion started by: RavinderSingh13
8 Replies
wwwoffle(1)						      General Commands Manual						       wwwoffle(1)

NAME
wwwoffle - A program to control the World Wide Web Offline Explorer. SYNOPSIS
wwwoffle -h | --help --version wwwoffle -online [-p <host>[:<port>] | -c <config-file>] wwwoffle -autodial [-p <host>[:<port>] | -c <config-file>] wwwoffle -offline [-p <host>[:<port>] | -c <config-file>] wwwoffle -fetch [-p <host>[:<port>] | -c <config-file>] wwwoffle -config [-p <host>[:<port>] | -c <config-file>] wwwoffle -dump [-p <host>[:<port>] | -c <config-file>] wwwoffle -cyclelog [-p <host>[:<port>] | -c <config-file>] wwwoffle -purge [-p <host>[:<port>] | -c <config-file>] wwwoffle -status [-p <host>[:<port>] | -c <config-file>] wwwoffle -kill [-p <host>[:<port>] | -c <config-file>] wwwoffle [-o|-O] [-p <host>[:<port>] | -c <config-file>] URL wwwoffle [-d[<depth>] | -r[<depth>] | -R[<depth>]] [-g[Sisfo]] [-F] [-p <host>[:<port>] | -c <config-file>] URL1 [URL2 [... URL]] wwwoffle [-d[<depth>] | -r[<depth>] | -R[<depth>]] [-g[Sisfo]] [-F] [-p <host>[:<port>] | -c <config-file>] file1 [file2 [... file]] wwwoffle -post [-p <host>[:<port>] | -c <config-file>] URL wwwoffle -put [-p <host>[:<port>] | -c <config-file>] URL DESCRIPTION
wwwoffle controls the World Wide Web Offline Explorer proxy HTTP server. The wwwoffle program is used to control the wwwoffled program, to tell it when the computer is online or offline, and which URLs to get and when to fetch them. The control options are also available from the server on an interactive control web page at http://localhost:8080/control/. OPTIONS
The command line options available for the program are described below. -h | --help A help message is printed giving a brief description of the usage of the program. --version The version number of the program is printed. -online Tell the wwwoffled proxy server that the computer is online to the internet and that requests are to be fetched immediately. -autodial Tell the wwwoffled proxy server that the computer can become online to the internet if required for requests that are not already cached, but that pages that are in the cache do not require any network access. This is intended for use with dial-on-demand sys- tems (using diald for example). -offline Tell the wwwoffled proxy server that the computer is not online to the internet and that requests are to be cached until they are fetched later. -fetch Tell the wwwoffled proxy server to fetch all of the requests that have been cached. (The proxy server must be online for this to work.) The program will wait until all of the requests have been met before exiting. -config Tell the wwwoffled proxy server to re-read the configuration file. -dump Tell the wwwoffled proxy server to dump out the current program configuration. This is equivalent to the most recently read config- uration file and the built-in default options. -cyclelog Tell the wwwoffled proxy server to close and then re-open the log file. -purge Tell the wwwoffled proxy server that the cache is to be purged. The configuration file wwwoffle.conf(5) specifies the maximum age of the pages to keep. If a maximum cache size is specified then the oldest pages are deleted until the size is not exceeded. -status Request from the wwwoffled proxy server the current status of the program. The online or offline mode, the fetch and purge sta- tuses, the number of current processes and their PIDs are displayed. -kill Tell the wwwoffled proxy server to exit cleanly at the next convenient point. URL The URL of a web page that is to be fetched. This is the same as using a browser and entering the URL if not already in the cache or pressing the refresh button in the index if it is in the cache. file The name of an HTML file that is to be parsed and the links in it are to be fetched as if the URLs had been specified on the command line. -o Fetch the specified URL (from the cache or request it if not already cached when offline, or get it when online) and output it on standard output. This is an easy way of getting an image out of the cache to be used in other programs. The contents of the Modi- fyHTML section of the configuration file are ignored and the unmodified data is output. -O Fetch the specified URL (from the cache or request it if not already cached when offline, or get it when online) and output it on standard output including the HTTP header. The contents of the ModifyHTML section of the configuration file are ignored and the unmodified data is output. -F Force the specified URLs to be refreshed. Without this option, the page will not be fetched unless newer than the version on the server. -r[<depth>] Causes the pages linked to by the specified URLs also to be fetched if they are on the same host. This recursion works for a number of links specified by the depth parameter, a depth of 0 means only the specified page, a depth of 2 means all linked pages and all links from them. -R[<depth>] The same as -r above, but it also works for links that are not on the same host. -d[<depth>] The same as -r above, but is limited to links in the same directory or a sub-directory. -gS Also fetches the stylesheets that are included in the specified URLs. -gi Also fetches the images that are included in the specified URLs. -gf Also fetches the frames that are included in the specified URLs. -gs Also fetches the scripts that are included in the specified URLs. -go Also fetches the objects that are included in the specified URLs. -post Create a request using the POST method, the data is read from stdin, and appended to the request. The user must ensure that the format of the data is valid for a POST request. Any of the characters '&', '=' or ';' that are not being used for their reserved purpose must be URL-encoded in the input, other characters will be URL-encoded. -put Create a request using the PUT method, the data is read from stdin and appended to the request. -c <config-file> Specifies the name of the configuration file that contains the server host name, port numbers and authorisation password. This is required for the -online, -autodial, -offline, -fetch, -config, -dump, -purge, -status and -kill options if a password is set. The user must have read access to the configuration file to be able to use the command if a password is set. (See the StartUp and LocalHost section of wwwoffle.conf(5) for more information on setting the server host name, ports and password.) -p <host>[:<port>] Sets the hostname and port number that is to be used for the connection to the proxy server. For the -online, -autodial, -offline, -fetch, -config, -dump, -purge, -status and -kill options this must be the WWWOFFLE control port, for the URL options it must be the WWWOFFLE HTTP proxy server port. If no -p option is specified then the compile-time defaults are used. When the -F , -R[<depth>] , -r[<depth>] , -d[<depth>] or -g[Sisfo] options are given then they will override the options that are set in the FetchOptions section of the configuration and not fetch any other contents of the specified URL. For example if the fetch options nor- mally include images and frames then using the -gi option will only fetch images and not frames. All page contents to be fetched must be specified as command line options. Specifying -g without any options will fetch only the specified URL without any of the options. ENVIRONMENT VARIABLE
The WWWOFFLE_PROXY environment variable can be used instead of the -c or -p options. There are three ways that the variable can be used. 1. When the variable is set to absolute pathname of a file, then that file is used as the configuration file like the -c option (for example /etc/wwwoffle/wwwoffle.conf). 2. The WWWOFFLE_PROXY variable can also be set to the hostname and the port number that would be used with the -p option (for example localhost:8080). 3. The third possibility is to set the variable to the hostname and the two port numbers for the WWWOFFLE HTTP proxy port and the WWWOFFLE control port (for example localhost:8080:8081). This way it will work with both types of commands (proxy access and con- trol). SEE ALSO
wwwoffled(8), wwwoffle.conf(5), diald(8). AUTHOR
Andrew M. Bishop 1996-2009 (amb@gedanken.demon.co.uk) March 13, 2009 wwwoffle(1)
All times are GMT -4. The time now is 02:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy