<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Shell script filename expansion in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666781#M931776</link>
    <description>Sebastien,&lt;BR /&gt;&lt;BR /&gt;What you need to do is quote the parameter, all the time. For example if your script is named test. The user will have to type:&lt;BR /&gt;&lt;BR /&gt;test "/*/params"&lt;BR /&gt;&lt;BR /&gt;This will make sure that the shell won't expand it. Then in the script you will also quote the parameter when you want to resend it to a unix command:&lt;BR /&gt;&lt;BR /&gt;test2 "$1"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Luc&lt;BR /&gt;</description>
    <pubDate>Mon, 18 Feb 2002 18:06:07 GMT</pubDate>
    <dc:creator>Luc Bussieres</dc:creator>
    <dc:date>2002-02-18T18:06:07Z</dc:date>
    <item>
      <title>Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666779#M931774</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;After a few search in the forum, I would like to do a wrapper for a unix command and I want to pass /*/zaza as script parameter and the script resend this parameter to the unix command without expanding the *....&lt;BR /&gt;&lt;BR /&gt;Please help wanted....</description>
      <pubDate>Mon, 18 Feb 2002 17:56:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666779#M931774</guid>
      <dc:creator>Sebastien Masson</dc:creator>
      <dc:date>2002-02-18T17:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666780#M931775</link>
      <description>Add a backslash prior to the * to avoaid shell expanding the *.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/\*/zaza</description>
      <pubDate>Mon, 18 Feb 2002 18:02:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666780#M931775</guid>
      <dc:creator>Tom Danzig</dc:creator>
      <dc:date>2002-02-18T18:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666781#M931776</link>
      <description>Sebastien,&lt;BR /&gt;&lt;BR /&gt;What you need to do is quote the parameter, all the time. For example if your script is named test. The user will have to type:&lt;BR /&gt;&lt;BR /&gt;test "/*/params"&lt;BR /&gt;&lt;BR /&gt;This will make sure that the shell won't expand it. Then in the script you will also quote the parameter when you want to resend it to a unix command:&lt;BR /&gt;&lt;BR /&gt;test2 "$1"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Luc&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Feb 2002 18:06:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666781#M931776</guid>
      <dc:creator>Luc Bussieres</dc:creator>
      <dc:date>2002-02-18T18:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666782#M931777</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you need to stop the shell from evaluating the wildcard, so the script must be called with quotes. &lt;BR /&gt;&lt;BR /&gt;script '/*/zaza'&lt;BR /&gt;&lt;BR /&gt;inside the script $1 will be '/*/zaza' WITHOUT the quotes.&lt;BR /&gt;&lt;BR /&gt;Since the line in your script will be evaluated by a shell again, you need to re-insert quotes. But plainly reinserting quotes might hinder the shell from evaluating the $-sign to expand the parameter so you need to use double quoutes, therefore the call inside your script needs to be&lt;BR /&gt;&lt;BR /&gt;call_inside_script "$1"&lt;BR /&gt;&lt;BR /&gt;See the following to explain the quotes:&lt;BR /&gt;&lt;BR /&gt;# export HELLO='*'&lt;BR /&gt;&lt;BR /&gt;# echo $HELLO&lt;BR /&gt;Mail SD_CDROM a adabas b bin c cn_tmp dev etc home lib lost+found lsof-4.55-sd-11.00.depot mapvg01.map net nfs_mount omni omnicopy r&lt;BR /&gt;&lt;BR /&gt;# echo '$HELLO'&lt;BR /&gt;$HELLO&lt;BR /&gt;&lt;BR /&gt;# echo "$HELLO"&lt;BR /&gt;*&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;Volker &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Feb 2002 18:08:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666782#M931777</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2002-02-18T18:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666783#M931778</link>
      <description>Ok I think some few cmd output needed:&lt;BR /&gt;&lt;BR /&gt;----------------------------&lt;BR /&gt;My sample script: zazou.sh&lt;BR /&gt;----------------------------&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;echo $1&lt;BR /&gt;----------------------------&lt;BR /&gt;&lt;BR /&gt;Sure: echo /\*/zaza&lt;BR /&gt;return: /*/zaza&lt;BR /&gt;&lt;BR /&gt;But&lt;BR /&gt;&lt;BR /&gt;./zazou.sh /\*/zaza&lt;BR /&gt;return: /a01/zaza /a02/zaza /a03/zaza&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Feb 2002 18:17:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666783#M931778</guid>
      <dc:creator>Sebastien Masson</dc:creator>
      <dc:date>2002-02-18T18:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666784#M931779</link>
      <description>BTW did u try .. # export H=\/\*\/zaza &lt;BR /&gt;# echo $H should give&lt;BR /&gt;/*/zaza&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;g`d luck</description>
      <pubDate>Mon, 18 Feb 2002 18:19:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666784#M931779</guid>
      <dc:creator>T. M. Louah</dc:creator>
      <dc:date>2002-02-18T18:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666785#M931780</link>
      <description>Yes Sebastien,&lt;BR /&gt;&lt;BR /&gt;that is exactly correct.&lt;BR /&gt;If you want the script to display &lt;BR /&gt;&lt;BR /&gt;/*/zaza &lt;BR /&gt;&lt;BR /&gt;You need to use&lt;BR /&gt;&lt;BR /&gt;echo "$1"&lt;BR /&gt;&lt;BR /&gt;inside the script.&lt;BR /&gt;&lt;BR /&gt;In &lt;BR /&gt;echo $1 &lt;BR /&gt;the parameter $1 will be evaluated and after that the wildcard will be expanded.&lt;BR /&gt;&lt;BR /&gt;Volker</description>
      <pubDate>Mon, 18 Feb 2002 18:26:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666785#M931780</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2002-02-18T18:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666786#M931781</link>
      <description>Are you looking for "set -f"?&lt;BR /&gt;&lt;BR /&gt;Doing a &lt;BR /&gt;set -f&lt;BR /&gt;will turn off filename expansion. It will remained turned off till you issue a &lt;BR /&gt;set +f&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Tue, 19 Feb 2002 03:54:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666786#M931781</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2002-02-19T03:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script filename expansion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666787#M931782</link>
      <description>Hi Sebastien,&lt;BR /&gt;&lt;BR /&gt;quoting (masquerading) of special characters isn't as trivial as people often think! But if you know the rules, it can be very simple:&lt;BR /&gt;&lt;BR /&gt;'string_to_quote'--&amp;gt; quotes every special character within...&lt;BR /&gt;&lt;BR /&gt;"string_to_quote" --&amp;gt;quotes some special characters, but others are not quoted, within there is continuing variable substitution and command substitution, so the $- character and the ``backticks are not quoted!&lt;BR /&gt;&lt;BR /&gt;\special_character --&amp;gt;quotes the character which is following directly, only one character!&lt;BR /&gt;&lt;BR /&gt;The next thing you need to know is, how a shell interpretes a command line before it is executed:&lt;BR /&gt;&lt;BR /&gt;the shell takes a look at the whole command line and seeks for special characters to be interpreted, like backticks for command substitution or a $-character for variable substitution. It is easy to find out how the command line looks like after interpreting but before execution:&lt;BR /&gt;&lt;BR /&gt;set -o xtrace&lt;BR /&gt;command_line&lt;BR /&gt;set +o xtrace&lt;BR /&gt;&lt;BR /&gt;set -o xtrace turns on a debugging mode which shows you the command line after interpretation with a + character in front of the line. Then you see the output of the command line. &lt;BR /&gt;set +o turns of the debugging mode. These two lines at the beginning and at the end of your scripts can be very helpful when searching for errors!&lt;BR /&gt;&lt;BR /&gt;example:&lt;BR /&gt;var=value&lt;BR /&gt;set -o xtrace&lt;BR /&gt;echo '$var' "$var" \$var   (RETURN)&lt;BR /&gt;+ echo $var value $var&lt;BR /&gt;$var value $var&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Tue, 19 Feb 2002 06:54:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-filename-expansion/m-p/2666787#M931782</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-02-19T06:54:25Z</dc:date>
    </item>
  </channel>
</rss>

