SH script, variable built command fails, but works at command line
I am working with a sh script on a solaris 9 zone (sol 10 host) that grabs information to build the configuration command line. the variables Build64, SSLopt, CONFIGopt, and CC are populated in the script. the script includes
When i run the sh -x script.sh i get the following output.
config.log just has: configure:4078: "/usr/local/bin/gcc: No such file or directory.
BUT if I copy that command line and paste it to the prompt everything works.
if i put that expanded command line into the script, it works
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT REDHAT
doconfig
doconfig(3NSL) Networking Services Library Functions doconfig(3NSL)NAME
doconfig - execute a configuration script
SYNOPSIS
cc [ flag ... ] file ... -lnsl [ library ... ]
# include <sac.h>
int doconfig(int fildes, char *script, long rflag);
DESCRIPTION
doconfig() is a Service Access Facility library function that interprets the configuration scripts contained in the files
</etc/saf/pmtag/_config>, </etc/saf/_sysconfig>, and </etc/saf/pmtag/svctag>, where pmtag specifies the tag associated with the port moni-
tor, and svctag specifies the service tag associated with a given service. See pmadm(1M) and sacadm(1M).
script is the name of the configuration script; fildes is a file descriptor that designates the stream to which stream manipulation opera-
tions are to be applied; rflag is a bitmask that indicates the mode in which script is to be interpreted. If rflag is zero, all commands in
the configuration script are eligible to be interpreted. If rflag has the NOASSIGN bit set, the assign command is considered illegal and
will generate an error return. If rflag has the NORUN bit set, the run and runwait commands are considered illegal and will generate error
returns.
The configuration language in which script is written consists of a sequence of commands, each of which is interpreted separately. The fol-
lowing reserved keywords are defined: assign, push, pop, runwait, and run. The comment character is #; when a # occurs on a line, every-
thing from that point to the end of the line is ignored. Blank lines are not significant. No line in a command script may exceed 1024 char-
acters.
assign variable=value
Used to define environment variables. variable is the name of the environment variable and value is the value to be assigned to it. The
value assigned must be a string constant; no form of parameter substitution is available. value may be quoted. The quoting rules are
those used by the shell for defining environment variables. assign will fail if space cannot be allocated for the new variable or if
any part of the specification is invalid.
push module1[, module2, module3, . . .]
Used to push STREAMS modules onto the stream designated by fildes. module1 is the name of the first module to be pushed, module2 is the
name of the second module to be pushed, etc. The command will fail if any of the named modules cannot be pushed. If a module cannot be
pushed, the subsequent modules on the same command line will be ignored and modules that have already been pushed will be popped.
pop [module]
Used to pop STREAMS modules off the designated stream. If pop is invoked with no arguments, the top module on the stream is popped. If
an argument is given, modules will be popped one at a time until the named module is at the top of the stream. If the named module is
not on the designated stream, the stream is left as it was and the command fails. If module is the special keyword ALL, then all mod-
ules on the stream will be popped. Note that only modules above the topmost driver are affected.
runwait command
The runwait command runs a command and waits for it to complete. command is the pathname of the command to be run. The command is run
with /usr/bin/sh -c prepended to it; shell scripts may thus be executed from configuration scripts. The runwait command will fail if
command cannot be found or cannot be executed, or if command exits with a non-zero status.
run command
The run command is identical to runwait except that it does not wait for command to complete. command is the pathname of the command to
be run. run will not fail unless it is unable to create a child process to execute the command.
Although they are syntactically indistinguishable, some of the commands available to run and runwait are interpreter built-in commands.
Interpreter built-ins are used when it is necessary to alter the state of a process within the context of that process. The doconfig()
interpreter built-in commands are similar to the shell special commands and, like these, they do not spawn another process for execution.
See sh(1). The built-in commands are:
cd
ulimit
umask
RETURN VALUES
doconfig() returns 0 if the script was interpreted successfully. If a command in the script fails, the interpretation of the script ceases
at that point and a positive number is returned; this number indicates which line in the script failed. If a system error occurs, a value
of -1 is returned. When a script fails, the process whose environment was being established should not be started.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO sh(1), pmadm(1M), sacadm(1M), attributes(5)NOTES
This interface is unsafe in multithreaded applications. Unsafe interfaces should be called only from the main thread.
SunOS 5.10 30 Dec 1996 doconfig(3NSL)