Sponsored Content
Top Forums Shell Programming and Scripting any explanation for thsi shell script behaviour Post 10208 by Perderabo on Friday 9th of November 2001 11:27:25 AM
Old 11-09-2001
Quote:
Originally posted by TioTony
However, the following should be equivalent:

sh myscript
./myscript <- only one .
Actually, these do work differently and how apparent the differences are depends on your kernel. When the trick of allowing the kernel itself to run a script first appeared, the suid and sgid bits were respected. With a kernel like that, "./myscript" could run with the effective uid or effective gid set according to the file's permissions. On the other hand, "sh ./myscript" will never run with alternate permissions.

This opened up a nasty security hole that could not be closed and most kernels these days no longer support suid/sgid shell scripts.

However the development of the fd psuedo-filesystem has provided a way to close that formerly unclosable hole. So it's possible that suid/sgid scripts may return. And in any event, I wouldn't bet the rent that no kernel currently running supports suid/sgid scripts.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

explanation for a script

Guys, was wondering what the meaning of the below bit is ? awk -F ' ' '{print $1 " " $2 ;}' $TEMPFILE | (rm -f $TEMPFILE; sed 's/$/ '"$box"'/g' > $TEMPFILE) Can anyone explain this in detail? what is the significance of rm -f $TEMPFILE here? What all IO/buffering happens here ?How the... (0 Replies)
Discussion started by: hashin_p
0 Replies

2. Shell Programming and Scripting

Spaces behaviour in shell

Hello, I am a bit puzzled by the way my shell treats spaces in filenames. An example will be way clearer than any explanation I can make: $ ls test\ file\ with\ spaces test file with spaces $ var="test\ file\ with\ spaces" $ echo $var test\ file\ with\ spaces $ ls $var ls: cannot... (4 Replies)
Discussion started by: SDelroen
4 Replies

3. Shell Programming and Scripting

Explanation for interesting sed behaviour?

This is my first post so hi to you all. I have browsed these forums in the past and what a great community and resource this is! Thanks to all the contributors ... I look forward to being able to give something back. In the meantime, I have a little conundrum concerning sed. My very simple... (6 Replies)
Discussion started by: Gavster
6 Replies

4. UNIX for Dummies Questions & Answers

shell: reconcile language and sort behaviour

Hi Don't know if this is a dummy question, but let's give it a try. I yesterday had a problem with undefined behaviour in the sort shell command (I'm using bash), leading to different sort orders without apparent reasons. I resolved this by typing export LC_ALL="C" export LC_COLLATE="C"... (5 Replies)
Discussion started by: jossojjos
5 Replies

5. Shell Programming and Scripting

Shell Script Explanation

Hello, I have seen this script on this site. I understand most of it. However I am a bit stuck on the part in red. It appears to be expanding for file in *.zip do zipdir=${file%.*} mkdir $zipdir || echo "unable to create $zipdir" cp $file $zipdir || echo "unable to copy $file"... (3 Replies)
Discussion started by: jaysunn
3 Replies

6. Shell Programming and Scripting

need an explanation on this script...

The following script will create a directory in a directory and will go on as many times as the number you will give in. I am trying to find out how it works ... can someone please help me with that? #!/bin/sh #create a variable and set it to 1 n=1 #start a loop as... (3 Replies)
Discussion started by: I-1
3 Replies

7. Solaris

Explanation of script

Hello Guys, can someone help explain the script below for me? I will really appreciate it. vi db_script #!/bin/sh echo .cron job run on.`date`> cronjob.txt df -h >> cronjob.txt echo welcome to home (2 Replies)
Discussion started by: cjashu
2 Replies

8. Shell Programming and Scripting

Korn shell behaviour in AIX

Hi, Consider the code snippet below: fun() { while read x do echo $x done < somefile_that_does_not_exists } fun echo I am here Korn shell on HPUX prints the message "I am here", while the behaviour is different on AIX korn shell. We do not get the message on AIX. Any... (5 Replies)
Discussion started by: 116@434
5 Replies

9. Shell Programming and Scripting

What does this shell script do? Need in depth explanation please

Hi My friend wrote this particular script and won't tell me what it does, and when I run it I don't understand it. What does the entire script do with specifics please. Thanks Bob #!/bin/bash current=0 while ; do if ; then echo ${current} current=$((${current}+1)) fi done (1 Reply)
Discussion started by: shadowknight777
1 Replies

10. Shell Programming and Scripting

Shell script explanation

Hey, can someone explain me this script? i=0 while read WORT do echo $WORT|grep a>/dev/null || echo$WORT|grep B>dev/null || let i=$i+1 done echo $i The first lane initializie the variable i with the value of 0. The loop line has 3 different options because of ||. The only option I... (10 Replies)
Discussion started by: newuser21
10 Replies
HTTP::Cache::Transparent(3pm)				User Contributed Perl Documentation			     HTTP::Cache::Transparent(3pm)

NAME
HTTP::Cache::Transparent - Cache the result of http get-requests persistently. SYNOPSIS
use LWP::Simple; use HTTP::Cache::Transparent; HTTP::Cache::Transparent::init( { BasePath => '/tmp/cache', } ); my $data = get( 'http://www.sn.no' ); DESCRIPTION
An implementation of http get that keeps a local cache of fetched pages to avoid fetching the same data from the server if it hasn't been updated. The cache is stored on disk and is thus persistent between invocations. Uses the http-headers If-Modified-Since and ETag to let the server decide if the version in the cache is up-to-date or not. The cache is implemented by modifying the LWP::UserAgent class to seamlessly cache the result of all requests that can be cached. INITIALIZING THE CACHE
HTTP::Cache::Transparent provides an init-method that sets the parameters for the cache and overloads a method in LWP::UserAgent to activate the cache.After init has been called, the normal LWP-methods (LWP::Simple as well as the more full-fledged LWP::Request methods) should be used as usual. init Initialize the HTTP cache. Takes a single parameter which is a hashref containing named arguments to the object. HTTP::Cache::Transparent::init( { # Directory to store the cache in. BasePath => "/tmp/cache", # How many hours should items be kept in the cache # after they were last requested? # Default is 8*24. MaxAge => 8*24, # Print progress-messages to STDERR. # Default is 0. Verbose => 1, # If a request is made for a url that has been requested # from the server less than NoUpdate seconds ago, the # response will be generated from the cache without # contacting the server. # Default is 0. NoUpdate => 15*60, # When a url has been downloaded and the response indicates that # has been modified compared to the content in the cache, # the ApproveContent callback is called with the HTTP::Response. # The callback shall return true if the response shall be used and # stored in the cache or false if the response shall be discarded # and the response in the cache used instead. # This mechanism can be used to work around servers that return errors # intermittently. The default is to accept all responses. ApproveContent => sub { return $_[0]->is_success }, } ); The directory where the cache is stored must be writable. It must also only contain files created by HTTP::Cache::Transparent. Initializing from use-line An alternative way of initializing HTTP::Cache::Transparent is to supply parameters in the use-line. This allows you to write use HTTP::Cache::Transparent ( BasePath => '/tmp/cache' ); which is exactly equivalent to use HTTP::Cache::Transparent; HTTP::Cache::Transparent::init( BasePath => '/tmp/cache' ); The advantage to using this method is that you can do perl -MHTTP::Cache::Transparent=BasePath,/tmp/cache myscript.pl or even set the environment variable PERL5OPT PERL5OPT=-MHTTP::Cache::Transparent=BasePath,/tmp/cache myscript.pl and have all the http-requests performed by myscript.pl go through the cache without changing myscript.pl INSPECTING CACHE BEHAVIOR
The HTTP::Cache::Transparent inserts two special headers in the HTTP::Response object. These can be accessed via the HTTP::Response::header()-method. X-Cached This header is inserted and set to 1 if the response is delivered from the cache instead of from the server. X-Content-Unchanged This header is inserted and set to 1 if the content returned is the same as the content returned the last time this url was fetched. This header is always inserted and set to 1 when the response is delivered from the cache. LIMITATIONS
This module has a number of limitations that you should be aware of before using it. - There is no upper limit to how much diskspace the cache requires. The only limiting mechanism is that data for urls that haven't been requested in the last MaxAge hours will be removed from the cache the next time the program exits. - Currently, only get-requests that store the result in memory (i.e. do not use the option to have the result stored directly in a file or delivered via a callback) is cached. I intend to remove this limitation in a future version. - The support for Ranges is a bit primitive. It creates a new object in the cache for each unique combination of url and range. This will work ok as long as you always request the same range(s) for a url. - The cache doesn't properly check and store all headers in the HTTP request and response. Therefore, if you request the same url repeatedly with different sets of headers (cookies, accept-encoding etc), and these headers affect the response from the server, the cache may return the wrong response. CACHE FORMAT
The cache is stored on disk as one file per cached object. The filename is equal to the md5sum of the url and the Range-header if it exists. The file contains a set of key/value-pairs with metadata (one entry per line) followed by a blank line and then the actual data returned by the server. The last modified date of the cache file is set to the time when the cache object was last requested by a user. AUTHOR
Mattias Holmlund, <$firstname -at- $lastname -dot- se> <http://www.holmlund.se/mattias/> GIT REPOSITORY
A git repository containing the source for this module can be found via http://git.holmlund.se/ COPYRIGHT AND LICENSE
Copyright (C) 2004-2007 by Mattias Holmlund This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available. perl v5.12.4 2007-12-12 HTTP::Cache::Transparent(3pm)
All times are GMT -4. The time now is 08:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy