Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: why is SHINSTDIN an option?



On Apr 11, 12:13am, Richard J. Coleman wrote:
} Subject: why is SHINSTDIN an option?
}
} Is there any reason for SHINSTDIN to be an option?
} is there any time where a user would want to set this himself?

I think it's an option mostly so it can be tested, rather than set.

    if [[ -o shinstdin ]]
    then
	echo "I was run with 'zsh < somefile', so \$0 is zsh"
    else
	echo "I was run with 'zsh $0' or '. $0' or just as '$0'"
    fi

I suppose there might be some reason to want to spoof the above by
setopt/unsetopt of shinstdin, but I can't think of one offhand.

Further, it could conceivably have other uses, particularly as a
command-line option.  Consider:

    #! /usr/local/bin/zsh -s
    echo This does not happen.

I'd be reluctant to eliminate the option, if that's what you are
thinking about.

-- 
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@xxxxxxxxxx                  Division of NCD Software Corporation
http://www.well.com/www/barts




Messages sorted by: Reverse Date, Date, Thread, Author