1748210 Members
2799 Online
108759 Solutions
New Discussion юеВ

Re: Scripting Issue

 
SOLVED
Go to solution
Dewa Negara_4
Regular Advisor

Scripting Issue

Hi All,

Please help on the scripting issue below:

[root@sihp8039:/var/opt/soeg/rpt]
# MSGMSG="21 - /var/opt/secu/log/root/* access is protected"

[root@sihp8039:/var/opt/soeg/rpt]
# echo $MSGMSG
21 - /var/opt/secu/log/root/remsh.log /var/opt/secu/log/root/su.log access is protected

That is not what I want. My expected output result as below.
# echo $MSGMSG
21 - /var/opt/secu/log/root/* access is protected

How to get that's output?

Thanks and Regards,
Negara
Santos
5 REPLIES 5
Jose Mosquera
Honored Contributor
Solution

Re: Scripting Issue

Hi,

Just disable the shell's file name generation (globbing), use "set -f". You can set and unset this option as often as required.

Rgds.
Dewa Negara_4
Regular Advisor

Re: Scripting Issue

Hi Jose,

Thanks for help. If I use "set -f", how to enable back the filename generation?

[root@sihp8039:/root]
# set -f

[root@sihp8039:/root]
# MSGMSG="21 - /var/opt/secu/log/root/* access is protected"

[root@sihp8039:/root]
# echo $MSGMSG
21 - /var/opt/secu/log/root/* access is protected


Thanks and Regards,
Negara
Santos
Jose Mosquera
Honored Contributor

Re: Scripting Issue

Hi,

Please try "set +f"

Rgds
Dewa Negara_4
Regular Advisor

Re: Scripting Issue

I got it. Thanks for your great help.
Santos
Dennis Handly
Acclaimed Contributor

Re: Scripting Issue

>How to get that output?

It is easier to quote it than to turn off globbing:
echo "$MSGMSG"

Another reason for quoting is to maintain multiple spaces.