Bash set dummy ?

Could somebody please provide me with verbatim description / purpose of the following ?

set dummy $ac_prog; ac_word=$2
set dummy $ac_tool_prefix; ac_word=$2

could it be written

set dummy $ac_prog; 
ac_word=$2
set dummy $ac_tool_prefix; 
ac_word=$2

.....more code here

set dummy ${ac_tool_prefix}strip; ac_word=$2

Thanks , appreciate you taking time to help me.

1 Like

What you posted is not bash syntax. Some other shells use set somewhat like what you wrote. Where and what is your source for this code?

PS:

  1. please use code tags
  2. please give us the name of your UNIX-- like ubuntu , H P-Ux
1 Like

check out: echo $SHELL

Thanks for reply.

Do you want me to post the entire "configure" ? It's about 15000 lines.

How is that going to answer my question ?

I am looking for a description of "set" as used.

set sets positional parameters

set hallo anne
echo $1
-> hallo
echo $2
-> anne

For a description read ...

man $SHELL
 

To help better, please specify your environment as already requested, so the people here can help better. Different Environments behave differently.

Written as is, the first command will set the positional parameters to the string constant "dummy" and the value of $ac_prog . Check it with e.g. echo $@ . Then, ac_word will be assigned the second pos. parameter's value, i.e. the value found in $ac_prog .

Yes, commands in bash can be written each on its own line.

The last command will set the second pos.param. to a string concatenated from ${ac_tool_prefix} 's value and the string constant "strip".

It does ac_word=(first word of $ac_prog) and just uses dummy as insulation:

set dummy a b c d e # $1=dummy, $2=a, $3=b, $4=c etc
word=$2

This looks pointless but is actually in case $ac_prog contains contents set would throw up on, like -x argument argument which set would take as weird commandline arguments and crash with syntax errors, or worse, set shell configuration parameters which change how the program works.

set -- arguments is the modern way, but ./configure is backwards-compatible with 1977 in case it has to run on someone's PDP.

./configure is machine-generated so often looks a little pointless or sketchy.

Up to now you didn't give any context of where you found that construct and in fact the question was meant about getting more of this - needed - context to help you better than with a very general-purpose answer. It is OK, though to aim for worse help, though - it is your loss, not ours.

OK, no problem: set is a bash builtin. In bash it is used to set various "readline"-variables. None of these variables is "dummy", though, therefore it is not clear to me what bash would do with this command. See man bash and search for "Readline Variables" for details.

I hope this helps.

bakunin

I am little overwhelmed by all responses.

I appreciate the ones actually answering my original post.

Thanks for those - it really helps.
I do not care for now very common administrative nagging / tagging and like to make sure the "guilty " knows that.
And let us leave it at that.
I am not sure why knowing the environment is important - I was asking about bash command

which IMHO should and apparently was enough to get the replies.

So - the OS is Ubuntu, the task is to find out why "bluez" package" configure" does not build (C++) library of requested architecture.

If possible I like to keep specific code questions and analyzes of "configure" separate.

From other forum experience - some administrators do not read the post and feel like I am reposing stuff.
Doing so it makes my troubleshooting process more manageable than trying to keep everything 'under one roof".

Cheers

Your original post was very unclear -- perhaps through no real fault of your own; autoconf-generated code looks so archaic and weird it could almost be mistaken for Perl. And it's not BASH code exactly, only Bourne, which gave the impression you might not know what language it really was. I recognized that it looked like it was from autoconf -- which actually muddied the waters since autoconf is a writhing mass of 3 or 4 interdependent and partly-overlapping languages(autoconf, m4, make, shell) generating code for each other.

I only realized what it was from one lucky google find, really.

Knowing it was from ./configure would have helped, we would have known for sure it actually was shell and not some other language :smiley: