Sponsored Content
Top Forums Shell Programming and Scripting SH script, variable built command fails, but works at command line Post 302700997 by oly_r on Friday 14th of September 2012 02:11:51 PM
Old 09-14-2012
Corona i'm confused that the command works fine when entered at the command line.

Code:
./configure CC="gcc -m64 -mcpu=v9" ...


CRAPPPPPPP. i just realized i was using CC in the command line to pass and not letting the env variable to be executed. Thank you Corona you made me thing about the way CC and CFLAGS were set.

Code:
CC=`which gcc`; export CC
CFLAGS="-m64 -mcpu=v9"; export CFLAGS

This User Gave Thanks to oly_r For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

script works on command line, not in cron job

Hey there, I'm a total newbie unix guy here and just picking this stuff up. Have a very small script I put together that works fine from the command line but not once I put it in a cron job. Searched and found this thread and am wondering it it has something to do with setting variables, though the... (7 Replies)
Discussion started by: JackTheTripper
7 Replies

2. Shell Programming and Scripting

Cron job fails, but works fine from command line

I have a very basic script that essentially sends a log file, via FTP, to a backup server. My cron entry to run this every night is: 55 23 * * * /usr/bin/archive_logs The script runs perfectly when executed manually, and actually worked via cron for about three weeks. However, it mysteriously... (3 Replies)
Discussion started by: cdunavent
3 Replies

3. Shell Programming and Scripting

Zgrep works at command line but not in script?

Hi all- I'm trying to search through some .gz log files to verify certain feeds have passed through our app. I have a small script that I wrote in hopes that I could automate the checking but haven't been able to get the zgrep to work. When I copy it to the command line directly it works... (2 Replies)
Discussion started by: Cailet
2 Replies

4. Shell Programming and Scripting

This code works in the command line but not in a shl script

When I run this code from the command line works spinel.middlebury.edu:/u02/sct/banner/bandev2/middlebury/shl:DEV2$ ls ef* eftseq.dat spinel.middlebury.edu:/u02/sct/banner/bandev2/middlebury/shl:DEV2$ file_seq=$( < eftseq.dat) ... (1 Reply)
Discussion started by: rechever
1 Replies

5. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

6. UNIX for Dummies Questions & Answers

Works on command line but not in script

Hey guys. Hopefully this is an easy one but having reference similar problems on the web I still can't fix it. I am doing a recursive find and replace from a script. Of course I could just run the damn thing from the command line but it's bugging me now and want to get it working. grep -rl... (4 Replies)
Discussion started by: anthonyjstewart
4 Replies

7. UNIX for Dummies Questions & Answers

Works on command line but not in script; vncserver on solaris 10

Hi guys. My first post, so be gentle... On my Solaris 10 machine vnc server is running. I need a command to extract most recent client session number (screen). So with: Code: bash-3.2# ps -ef | grep vnc | grep Xaut root 19805 19797 0 15:41:44 ? 0:01 Xvnc :4 -inetd -once... (5 Replies)
Discussion started by: cp6uja
5 Replies

8. Shell Programming and Scripting

Works on command line but not in script

OSX 10.9 I am building a script that evaluates the difference between 2 files. Here is a command that does not work transparently. Running this command in Terminal yields great results; however when I put that line in a .sh script, I get the errors shown below. Am I doing something silly? ... (1 Reply)
Discussion started by: sudo
1 Replies

9. Shell Programming and Scripting

Find command works on Linux but fails on Solaris.

Hi, I am looking for a generic find command that works on both Linux and Solaris. I have the below command that works fine on Linux but fails on solaris.find /web/config -type f '(' -name '*.txt' -or -name '*.xml' -name '*.pro' ')' Fails on SunOS mysolaris 5.10 Generic_150400-61 sun4v sparc... (1 Reply)
Discussion started by: mohtashims
1 Replies

10. Shell Programming and Scripting

Replace string works on command-line but fails when run from shell script

I wish to replace "\\n" with a single white space. The below does the job on command-line: $ echo '/fin/app/scripts\\n/fin/app/01/sql' | sed -e 's#\\\\n# #g'; /fin/app/scripts /fin/app/01/sql However, when i have the same code to a shell script it is not able to get me the same output:... (8 Replies)
Discussion started by: mohtashims
8 Replies
STYLE.MAKEFILE(5)					      BSD File Formats Manual						 STYLE.MAKEFILE(5)

NAME
style.Makefile -- FreeBSD Makefile file style guide DESCRIPTION
This file specifies the preferred style for makefiles in the FreeBSD source tree. o All makefiles should have an SCM ID at the start of the file, followed by a blank line. # $FreeBSD$ o .PATH: comes next if needed, and is spelled ``.PATH: '', with a single ASCII space after a colon. Do not use the VPATH variable. o Special variables (i.e., LIB, SRCS, MLINKS, etc.) are listed in order of ``product'', then building and installing a binary. Special variables may also be listed in ``build'' order: i.e., ones for the primary program (or library) first. The general ``product'' order is: PROG/[SH]LIB/SCRIPTS FILES LINKS [NO_]MAN MLINKS INCS SRCS WARNS CFLAGS DPADD LDADD. The general ``build'' order is: PROG/[SH]LIB/SCRIPTS SRCS WARNS CFLAGS DPADD LDADD INCS FILES LINKS [NO_]MAN MLINKS. o Omit SRCS when using <bsd.prog.mk> and there is a single source file named the same as the PROG. o Omit MAN when using <bsd.prog.mk> and the manual page is named the same as the PROG, and is in section 1. o All variable assignments are spelled ``VAR='', i.e., no space between the variable name and the =. Keep values sorted alphabetically, if possible. o Do not use += to set variables that are only set once (or to set variables for the first time). o Do not use vertical whitespace in simple makefiles, but do use it to group locally related things in more complex/longer ones. o WARNS comes before CFLAGS, as it is basically a CFLAGS modifier. It comes before CFLAGS rather than after CFLAGS so it does not get lost in a sea of CFLAGS statements as WARNS is an important thing. The usage of WARNS is spelled ``WARNS?= '', so that it may be overridden on the command line or in make.conf(5). o ``NO_WERROR= yes'' should not be used, it defeats the purpose of WARNS. It should only be used on the command line and in special cir- cumstances. o CFLAGS is spelled ``CFLAGS+= ''. o Listing -D's before -I's in CFLAGS is preferred for alphabetical ordering and to make -D's easier to see. The -D's often affect condi- tional compilation, and -I's tend to be quite long. Split long CFLAGS settings between the -D's and -I's. o Do not use GCCisms (such as -g and -Wall) in CFLAGS. o Typically, there is one ASCII tab between VAR= and the value in order to start the value in column 9. An ASCII space is allowed for variable names that extend beyond column 9. A lack of whitespace is also allowed for very long variable names. o .include <bsd.*.mk> goes last. o Do not use anachronisms like $< and $@. Instead use ${.IMPSRC} or ${.ALLSRC} and ${.TARGET}. o To not build the ``foo'' part of the base system, use NO_FOO, not NOFOO. o To optionally build something in the base system, spell the knob WITH_FOO not WANT_FOO or USE_FOO. The latter are reserved for the FreeBSD Ports Collection. o For variables that are only checked with defined(), do not provide any fake value. The desire to express a logical grouping often means not obeying some of the above. EXAMPLES
The simplest program Makefile is: # $FreeBSD$ PROG= foo .include <bsd.prog.mk> The simplest library Makefile is: # $FreeBSD$ LIB= foo SHLIB_MAJOR= 1 MAN= libfoo.3 SRCS= foo.c .include <bsd.lib.mk> SEE ALSO
make(1), make.conf(5), style(9) HISTORY
This manual page is inspired from the same source as style(9) manual page in FreeBSD. BUGS
There are few hard and fast style rules here. The style of many things is too dependent on the context of the whole makefile, or the lines surrounding it. BSD
January 8, 2005 BSD
All times are GMT -4. The time now is 08:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy