Sponsored Content
Top Forums Shell Programming and Scripting $$# is evaluating to 1 when no value Post 302300180 by jake_ryan on Monday 23rd of March 2009 12:09:58 PM
Old 03-23-2009
$$# is evaluating to 1 when no value

I have the following in my makefile:
Code:
    RESULT=`../${TOOLS_ROOT_PATH}/ext_tools.sh 11`; \
    set $$RESULT > tMp; \
    rm tMp; \
    if [ $$# -ne 0 ]; then \
        echo copying external-local tool: $< \($$*\); \
        mkdir -p ${EXTERNAL_LOCAL_BIN_DIR}/$<; \
        cp -f `../${TOOLS_ROOT_PATH}/ext_tools.sh 11` ${EXTERNAL_LOCAL_BIN_DIR}/$< || exit $$?;\
        if [ -f $<"-install-script" ]; then \
            echo copying $<"-install-script"; \
            mkdir -p ${EXTERNAL_LOCAL_BIN_DIR}/install-scripts; \
            cp -f $<"-install-script" ${EXTERNAL_LOCAL_BIN_DIR}/install-scripts; \
            chmod +x ${EXTERNAL_LOCAL_BIN_DIR}/install-scripts/$<"-install-script"; \
        fi; \
    fi; \
    set `../${TOOLS_ROOT_PATH}/ext_tools.sh 12` > tMp; \
    if [ $$# -ne 0 ]; then \
        echo copying external-remote tool: $< \($$*\); \
        mkdir -p ${EXTERNAL_REMOTE_BIN_DIR}/$<; \
        cp -f `../${TOOLS_ROOT_PATH}/ext_tools.sh 11` ${EXTERNAL_REMOTE_BIN_DIR}/$< || exit $$?;\
        if [ -f $<"-install-script" ]; then \
            echo copying $<"-install-script"; \
            mkdir -p ${EXTERNAL_REMOTE_BIN_DIR}/install-scripts; \
            cp -f $<"-install-script" ${EXTERNAL_REMOTE_BIN_DIR}/install-scripts; \
            chmod +x ${EXTERNAL_REMOTE_BIN_DIR}/install-scripts/$<"-install-script"; \
        fi; \
    fi; \
    rm tMp; \

When ext_tools.sh returned nothing, the $$# in the second if-condition is evaluating to 1. Any idea why it is happening is much appreciated.

Code:
+ .././makefiles/tools/ext_tools.sh 11
RESULT=test_tool1
+ set test_tool1
+ rm tMp
+ [ 1 -ne 0 ]
+ echo copying external-local tool: test_tool1 (test_tool1)
copying external-local tool: test_tool1 (test_tool1)
+ mkdir -p /tmp/lmcsrpe/ggsn_ttx/external/local/bin/ttx/external/test_tool1
+ .././makefiles/tools/ext_tools.sh 11
+ cp -f test_tool1 /tmp/lmcsrpe/ggsn_ttx/external/local/bin/ttx/external/test_tool1
+ [ -f test_tool1-install-script ]
+ .././makefiles/tools/ext_tools.sh 12
+ set
+ [ 1 -ne 0 ]
+ echo copying external-remote tool: test_tool1 (test_tool1)
copying external-remote tool: test_tool1 (test_tool1)
+ mkdir -p /tmp/lmcsrpe/ggsn_ttx/external/remote/bin/ttx/external/test_tool1
+ .././makefiles/tools/ext_tools.sh 11
+ cp -f test_tool1 /tmp/lmcsrpe/ggsn_ttx/external/remote/bin/ttx/external/test_tool1
+ [ -f test_tool1-install-script ]
+ rm tMp

Thanks

Last edited by Franklin52; 03-23-2009 at 03:03 PM.. Reason: adding code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

evaluating for a number

I apologize for the simple question but can someone please help me with how to evaluate a number? I will be reading in a file and if a number is >= 100000000, I will do something, if not, I will exit the if statement. Thanks in advance (1 Reply)
Discussion started by: hedrict
1 Replies

2. UNIX for Advanced & Expert Users

evaluating core files

Does anyone know any tools or how to really get something out of a core file. I can use strings and look for certain things like out of memory. I am trying to use adb but I can't make heads or tails from it. I guess it is my lack of know how with the adb/mdb debugger. anything would... (3 Replies)
Discussion started by: Gary Dunn
3 Replies

3. UNIX for Dummies Questions & Answers

evaluating variables

Hi I have a script in which I have several variables var1 var2 var3 var4 etc...... and field1 field2 field3 field4 etc....... The script similar to this: (6 Replies)
Discussion started by: Bab00shka
6 Replies

4. UNIX for Dummies Questions & Answers

evaluating params

Hi all, I ve a script like.... TBL=employee sql=`cat abhi.sql` \\ abhi.sql contains ------- select a from $TBL echo $TBL echo $sql SQL=`echo $sql` echo $SQL now i want SQL as select a from employee and as select a from $TBL How can I achieve this? Help appriciated (3 Replies)
Discussion started by: abzi
3 Replies

5. Shell Programming and Scripting

* character evaluating too soon - Help!

I have a user defined configuration file, which could contain the following type of entries: directory_001=/a/directory/structure pattern_001=fred* pattern_002=* I have a script which reads the file generically which will loop round loop 1 genvar=”directory” iteration=”001” ... (11 Replies)
Discussion started by: Bab00shka
11 Replies

6. UNIX for Dummies Questions & Answers

evaluating date +%m

how do i evaluate the value of date if ( $(date +%m) > 8 ) then FY_STAMP=FY$(echo $(($(date +%Y) + 1)) | cut -c3-4) else FY_STAMP=FY$(date +%y) fi i want this to make the FY_STAMP increment by 1 if the month is september and up. but cant seem to make it work (3 Replies)
Discussion started by: rsf01
3 Replies

7. Shell Programming and Scripting

K Shell evaluating value to a variable

Hi, I have the following requirement. V="First" R="V" echo $$R The output should be First. How do i achieve this. how do we evaluate the $R and evaluate it to $V as $R contains V and $V is First. Thanks Vijay (2 Replies)
Discussion started by: vijaykrc
2 Replies

8. Shell Programming and Scripting

if condition not evaluating as expected

Hi all, Thanks in advance for your time. I have a data file like this: 1 7.465753425 2 8.980821918 1 1.717808219 1 6.550684932 0 5.432876712 I wish to write a bash script to check both columns and output a 1 if col1==1 AND col2<3. Otherwise I want to output a 0. In the above... (5 Replies)
Discussion started by: jem8271
5 Replies

9. Shell Programming and Scripting

Evaluating a variable

Does anyone know of a way to force a variable name held in another variable to return the value of the first variable? Best if I give an example, that does not work: /usr/local/bin >cat mike.sh NUM1ref=16 NUM2ref=32 echo "==============" for VAR in NUM1 NUM2 do XXXX=${VAR}ref echo $XXXX... (4 Replies)
Discussion started by: mikejordan
4 Replies

10. UNIX for Dummies Questions & Answers

Comparing and Evaluating

Hi Guys, Good day ULF :) I hope you can help me again with my problem. I have a file which looks like this: Command was launched from partition 0. ------------------------------------------------ Executing command in server server3 Dec 18 21:31:12 AHM04 nseventmgr: EVENT-SET:... (4 Replies)
Discussion started by: rymnd_12345
4 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 07:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy