Bash set dummy ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash set dummy ?
# 1  
Old 03-28-2019
Bash set dummy ?

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





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

could it be written


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






.....more code here



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

Thanks , appreciate you taking time to help me.

Last edited by jim mcnamara; 03-28-2019 at 11:10 PM..
This User Gave Thanks to anne For This Post:
# 2  
Old 03-28-2019
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, HP-Ux
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 03-29-2019
check out: echo $SHELL
# 4  
Old 03-29-2019
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.
# 5  
Old 03-29-2019
set sets positional parameters

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

For a description read ...

Code:
man $SHELL


To help better, please specify your environment as already requested, so the people here can help better. Different Environments behave differently.
# 6  
Old 03-29-2019
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".
# 7  
Old 03-29-2019
It does ac_word=(first word of $ac_prog) and just uses dummy as insulation:

Code:
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do i check if all parameters are set in bash?

Hi, I have 4 parameters passed to my shell and i validate if all four are entered using the following snippet: if then echo "Not entered" else echo "entered" fi I get the following output as 'Not entered even when i enter the values for all prompts. Please advise. Thanks. (5 Replies)
Discussion started by: Jesshelle David
5 Replies

2. Shell Programming and Scripting

Bash script set command to a variable

Hi, Will following set up work in bash script? I've got errors if assigning following binary command to a variable. But on the other hand, COMMAND="ls" works. Any explanation please? How can I assign binary command to a variable COMMAND then I can just call ${COMMAND}? COMMAND="rsync"... (3 Replies)
Discussion started by: hce
3 Replies

3. Shell Programming and Scripting

How to trap set -o nounset in bash

I have a bash script using "set -o nounset" to prevent unset variables. However I have created a trap to run some cleanup options upon exit of the script which works fine for CTRL-C, etc. but if it hits and unset variable the trap does not run and the script bails out without having tidied up... (3 Replies)
Discussion started by: jelloir
3 Replies

4. UNIX for Dummies Questions & Answers

Is there a way to set ' and " as a non quotes type in bash?

Howdy, I got a script that adds a esc char before all chars interpeted by bash shell but I wan't other solution. Is there a way to set ' and " as a non quotes type in bash (some local variable)? Have found that scsh is a non-quoting type shell but after reading Why I don't use scsh as a scripting... (3 Replies)
Discussion started by: johny_be_good
3 Replies

5. Solaris

How do i permanently set bash profile??

Hi all, I don't want to enter below command on solaris every time. How do i permanently set this command on Solaris. I know that this operation is a piece of cake on redhat because there is a /etc/rc.local file on it. But Solaris ???? bash-3.00#export PS1="\e (2 Replies)
Discussion started by: getrue
2 Replies

6. Shell Programming and Scripting

Help with Bash script - set, awk

Trying to search a log file for a string, starting from a certain point in the log file. I want to return the number of lines that contain the search string and the total number of lines in the log file. Here's the part of the script I'm having problems with: set -- $(awk -v... (12 Replies)
Discussion started by: mglenney
12 Replies

7. Shell Programming and Scripting

test-and-set in bash

I'm not talking about the assembly instruction TAS, a better name could be check-and-set :) Anyway, is there a way to simplify the following if ; then VAR="something"; fi I have ~20 variables that should be test-and-set like this, and it really looks lame. (2 Replies)
Discussion started by: rayne
2 Replies

8. Shell Programming and Scripting

[bash] Check if variable is set or blank

Hello guys. In my script, i have the following code: echo "The tarfile contains these directorys" tar -tf file.tar > tarlist.txt cat tarlist | awk -F/ '{print $1 "/" $2}' | nl echo "Enter path of the directory you want to extract or just press enter to extract everything: " read path... (1 Reply)
Discussion started by: noratx
1 Replies

9. UNIX for Advanced & Expert Users

How to set up dummy printer on UNIX

Hi, I work at IT department of a home furnishing company in Canada. Presently we are working on printer issue on UNIX system and we like to set up a dummy printer on the system. We are not much sure about the procedure to try it and it woul dbe great if we get some advice to go ahead. Thanks... (3 Replies)
Discussion started by: srabanti
3 Replies

10. UNIX for Dummies Questions & Answers

Hardware dummy trying to set up Unix workstation for Oracle at home for practice!

I have been planning to set up a Unix workstation at home to host an Oracle database just for database admin. practice. But I don't know enough about hardware to know whether this can be done on a regular desktop and the required hardware config. If anyone could kindly guide me in this mission I... (4 Replies)
Discussion started by: tmanpakdee
4 Replies
Login or Register to Ask a Question