🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
9 messages
9 total messages Started by ����� Fri, 10 May 2002 12:52
How can I print "*" in unix shell program
#3837
Author: �����
Date: Fri, 10 May 2002 12:52
12 lines
1461 bytes
I wanna print *
But following script prints files in current directory
How can I print *

[root@ns /root]# cat a.sh
#!/bin/sh

AA="*"
echo $AA
[root@ns /root]# ./a.sh
Desktop a.sh dnsCache.db hostsInfo.db intop_history manage nsmail ntop_pw.db
sec
Re: How can I print "*" in unix shell program
#3838
Author: Nils O. Selåsdal
Date: Fri, 10 May 2002 12:58
16 lines
1580 bytes
In article <abgerh$g5j$1@news1.kornet.net>, ����� wrote:
> I wanna print *
> But following script prints files in current directory
> How can I print *
> 
> [root@ns /root]# cat a.sh
> #!/bin/sh
> 
> AA="*"
 echo "$AA"

> [root@ns /root]# ./a.sh
> Desktop a.sh dnsCache.db hostsInfo.db intop_history manage nsmail ntop_pw.db
> sec
> 
> 
Re: How can I print "*" in unix shell program
#3839
Author: laura fairhead
Date: Fri, 10 May 2002 17:24
35 lines
2190 bytes
On Fri, 10 May 2002 21:52:35 +0900, "�����" <myunggyu@hotmail.com> wrote:

>I wanna print *
>But following script prints files in current directory
>How can I print *
>
>[root@ns /root]# cat a.sh
>#!/bin/sh
>
>AA="*"
>echo $AA

You don't need quotes with the assignement because pathname expansion
isn't done on assignment words, however anywhere else in the line
unquoted fields are usually subject to pathname expansion so you do need
to quote the variable in the 'echo' command;

AA=*
echo "$AA"

>[root@ns /root]# ./a.sh
>Desktop a.sh dnsCache.db hostsInfo.db intop_history manage nsmail ntop_pw.db
>sec
>
>

seeya
-- 
laura fairhead  # laura@madonnaweb.com  http://lf.8k.com
                # if you are bored crack my sig.
1F8B0808CABB793C0000666667002D8E410E83300C04EF91F2877D00CA138A7A
EAA98F30C494480157B623C4EF1B508FDED1CEFA9152A23DE35D661593C5318E
630C313CD701BE92E390563326EE17A3CA818F5266E4C2461547F1F5267659CA
8EE2092F76C329ED02CA430C5373CC62FF94BAC6210B36D9F9BC4AB53378D978
80F2978A1A6E5D6F5133B67B6113178DC1059526698AFE5C17A5187E7D930492
Re: How can I print "*" in unix shell program
#3841
Author: Robert Towster
Date: Sun, 12 May 2002 23:25
22 lines
1979 bytes
how about:
set -f
echo *
set +f



����� wrote:
> I wanna print *
> But following script prints files in current directory
> How can I print *
> 
> [root@ns /root]# cat a.sh
> #!/bin/sh
> 
> AA="*"
> echo $AA
> [root@ns /root]# ./a.sh
> Desktop a.sh dnsCache.db hostsInfo.db intop_history manage nsmail ntop_pw.db
> sec
> 
> 
Re: How can I print "*" in unix shell program
#3840
Author: Robert Towster
Date: Sun, 12 May 2002 23:25
23 lines
2031 bytes
How about:
#!/bin/sh

set -f
echo *
set +f


����� wrote:
> I wanna print *
> But following script prints files in current directory
> How can I print *
> 
> [root@ns /root]# cat a.sh
> #!/bin/sh
> 
> AA="*"
> echo $AA
> [root@ns /root]# ./a.sh
> Desktop a.sh dnsCache.db hostsInfo.db intop_history manage nsmail ntop_pw.db
> sec
> 
> 
Re: How can I print "*" in unix shell program
#3842
Author: -wiseguy
Date: Sun, 12 May 2002 23:31
16 lines
1797 bytes
Robert Towster <ChangeTo_firstname@lastname.com> wrote in
news:3CDD8C9D.1070401@lastname.com: 

> How about:
> #!/bin/sh
> 
> set -f
> echo *
> set +f

or
echo \*

-- 
-- Rob Prowel (A.K.A. da wiseguy)
URL:  http://www.prowel.com/
Re: How can I print "*" in unix shell program
#3844
Author: Pascal Bourguignon
Date: Mon, 13 May 2002 01:40
41 lines
2302 bytes
Robert Towster <CHANGE_TO_firstname@lastname.com> writes:

> how about:
> set -f
> echo *
> set +f

Yes!  I can do more complicated too:

echo '#include <stdio.h>@int main(void){printf("*\n");return(0);}@'|tr '@' '\012'>a.c;cc a.c;a.out


> �������큱�� wrote:
> > I wanna print *
> > But following script prints files in current directory
> > How can I print *
> > 
> > [root@ns /root]# cat a.sh
> > #!/bin/sh
> > 
> > AA="*"
> > echo $AA
> > [root@ns /root]# ./a.sh
> > Desktop a.sh dnsCache.db hostsInfo.db intop_history manage nsmail ntop_pw.db
> > sec
 

-- 
__Pascal_Bourguignon__            (o_ Software patents are endangering
()  ASCII ribbon against html-    //\ the computer industry all around
/\ email & Microsoft attachments. V_/ the world http://lpf.ai.mit.edu/
1962:DO5K=1.3  2001:my($f)=`fortune`;  http://petition.eurolinux.org/

You're a web designer?   Please read http://www.useit.com/alertbox/ !

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d? s++:++(+++)>++ a C+++  UB+++L++++$S+X++++>$ P- L+++ E++ W++
N++ o-- K- w------ O- M++$ V PS+E++ Y++ PGP++ t+ 5? X+ R !tv b++(+)
DI+++ D++ G++ e+++ h+(++) r? y---? UF++++
------END GEEK CODE BLOCK------
Re: How can I print "*" in unix shell program
#3843
Author: Bill Marcum
Date: Mon, 13 May 2002 01:40
2 lines
1241 bytes
Is this a joke?  The subject line answers its own question.
print "*"
Re: How can I print "*" in unix shell program
#3845
Author: Floyd Davidson
Date: Mon, 13 May 2002 02:32
30 lines
1536 bytes
"�����" <myunggyu@hotmail.com> wrote:
>I wanna print *
>But following script prints files in current directory
>How can I print *
>
>[root@ns /root]# cat a.sh
>#!/bin/sh
>
>AA="*"
>echo $AA

 $cat a.sh
 #!/bin/sh
 
 AA="*"
 echo "$AA"

 $./a.sh
 *

>[root@ns /root]# ./a.sh

_Don't_ do these things as root.

>Desktop a.sh dnsCache.db hostsInfo.db intop_history manage nsmail ntop_pw.db
>sec

-- 
Floyd L. Davidson         <http://www.ptialaska.net/~floyd>
Ukpeagvik (Barrow, Alaska)                 floyd@barrow.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads