# shell script help needed

**URL:** <https://community.unix.com/t/shell-script-help-needed/163388>\
**Category:** Shell Programming and Scripting\
**Created:** [July 17, 2006, 1:30pm UTC](https://community.unix.com/t/shell-script-help-needed/163388 "2006-07-17T13:30:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fastgoon](https://community.unix.com/letter_avatar/fastgoon/32/6_449c533f586939b6e5f246632a46421f.png) [@fastgoon](https://community.unix.com/u/fastgoon)\
**Post date:** [July 17, 2006, 1:30pm UTC](https://community.unix.com/t/shell-script-help-needed/163388/1 "2006-07-17T13:30:08Z")

</div>

I am trying to query a table having 3 columns, the third column is a field of varchar(1024) with a SQL string in it. I am using cut command to split out the three fields into three variables. I do a db2 command to extract the data into a file.

My problem is with the third field having the SQL command. Example of data in the third field is "select A.\* from TRAN with UR;"

When the assignment  
query=`cat $TMP/adwtdtemp.tmp | cut -d '#' -f 3 | cut -d ';' -f 1` is executed, and when the contents of query variable is displayed, I get A.\* subsituted with all file names matching A.\*"

I tried the same with a simple script  
#!/bin/ksh  
echo "select A.\* from abc"  
echo $str  
str="select A.\* from abc"  
query=${str}  
echo $query  
exit 0

The output is  
select A\* from abc (from echo $str)  
select A.ksh A.log A.sh A.x from abc (from echo $query)

How do I make the script just assign the string and not do any substitutions?

Any help is appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![jim\_mcnamara](https://community.unix.com/letter_avatar/jim_mcnamara/32/6_449c533f586939b6e5f246632a46421f.png) [@jim\_mcnamara](https://community.unix.com/u/jim_mcnamara)\
**Post date:** [July 17, 2006, 2:40pm UTC](https://community.unix.com/t/shell-script-help-needed/163388/2 "2006-07-17T14:40:58Z")

</div>

search the man page for your shell for glob

You can turn off globbing with

```nohighlight
set noglob

```

in ksh for example.

---

<div class="post-metadata">

**Author:** ![Hitori](https://community.unix.com/user_avatar/community.unix.com/hitori/32/394_2.png) [@Hitori](https://community.unix.com/u/Hitori)\
**Post date:** [July 17, 2006, 3:55pm UTC](https://community.unix.com/t/shell-script-help-needed/163388/3 "2006-07-17T15:55:53Z")

</div>

note quotes:

```nohighlight
$ cat test.sh
#!/bin/sh

str="*"
echo "$str"
$ ./test.sh
*
$ 

```

---

<div class="post-metadata">

**Author:** ![fastgoon](https://community.unix.com/letter_avatar/fastgoon/32/6_449c533f586939b6e5f246632a46421f.png) [@fastgoon](https://community.unix.com/u/fastgoon)\
**Post date:** [July 17, 2006, 4:24pm UTC](https://community.unix.com/t/shell-script-help-needed/163388/4 "2006-07-17T16:24:42Z")

</div>

Thanks, the set +o noglob and set -o noglob command worked.
