Click to See Complete Forum and Search --> : Bash programming


Osh
09-29-2001, 10:20 PM
hi,
i am working on a bash shell script.
i use "set -f" to stop the path expation. But when i try to:

set -f
somevarible = /some/*
cp someverible anywere

i get an error that basicly says something about not working because of '/some/*'

if adds 's to it. i want to know if there is anyway to make it not do this or a way around it??

TIA

-Osh

The Kooman
10-01-2001, 12:25 AM
Originally posted by Osh:
<STRONG>hi,
i am working on a bash shell script.
i use "set -f" to stop the path expation. But when i try to:

set -f
somevarible = /some/*
cp someverible anywere

i get an error that basicly says something about not working because of '/some/*'

if adds 's to it. i want to know if there is anyway to make it not do this or a way around it??

TIA

-Osh</STRONG>

Is that a space between "somevariable" and "/some/*"? If so, remove it and try - you can't have spaces between the LHS and RHS in a variable assignment (assuming you're using bash).

Osh
10-01-2001, 06:21 PM
no,
no there is no space in the code.

-Osh

TheLinuxDuck
10-02-2001, 09:10 AM
Firstly, Koo is correct that a variable *must* be defined as:

variable=/path/to/*

and not

variable = /path/to/*


Also, with the pathname expansion turned off (set -f), the * glob will not work, and therefore the cp command does not know what to do with it, meaning that a filename with the name of * will prolly have to exist in the path listed, since the shell is not automatically expanding the glob.

What reason do you have for not using globbing?