Dear all
I am installing some eda software using script. My OS is ubuntu 10.04 and the eda software writing in csh. Since ubuntu reading script file in sh writting. I need someone can help me to convert some definition in script from csh to sh. Below is part of script
The sh cell command will post the error when it sees : setenv, unsetenv, limit and [ ]
How I can make a change of thoses? Thanks a lot
Last edited by Scott; 12-04-2011 at 07:06 AM..
Reason: Code tags
I have my main script calling another script to retrive a "ls -alt" of a directory that's located in a remote location I'm sftping into.
main.sh
#!/bin/ksh
getLS.sh > output.txt
getLS.sh
#!/bin/sh
/home<..>/sftp <host@ip> <<!
cd /some/dir/Log
ls -alt
quit
!
Basically I'd like to be... (2 Replies)
i have this method in csh that check for file exist.
#check that file exists
if ( ! -e $6$5 ) then
echo $6$5 Not Found
exit 8
endif
however i wanted in to be in just sh. so i change the code to:
if ; then
echo $6$5 Not Found
exit 8
fi
I get error... (1 Reply)
I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them)
Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Hi Everyone,
I have a body of code that I'd like to know how to convert to a csh file.
In Unix, under a directory, I wish to ls into each of its subdirectories:
In Unix prompt I type
foreach i(*)
foreach? ls $i
foreach? end
however, when I try to store this body of code in .csh:
... (2 Replies)
Hi ,
I am trying to convert the below code embedded in a csh script to Perl.
Can any expert give me some advice on this ?
sed -n ''"$start_line"',$ p' $tester_dir/nfiles_extracted.txt|cut -c1-4,6-|/bin/perl $test_summary/compare_for_all
_Duts.pl|sort > $tester_dir/nfiles_extracted1.txt (0 Replies)
Hi All,
Could any one of you give me a hand to convert the following line of codes from .sh to .csh please ?
proc_id=`fuser /tmp/test`
if
then
echo "File is not being used by any thing"
fi
if
then
echo "File is being used... please wait"
sleep 1
fi
Regards. (1 Reply)
Hi All,
Could any one of you give me a hand to convert the following line of codes from .sh to .csh please ?
proc_id=`fuser /tmp/test`
if
then
echo "File is not being used by any thing"
fi
if
then
echo "File is being used... please wait"
sleep 1
fi
Regards.
---------- Post... (1 Reply)
Hi,
I am currently using the below code and it throws an error saying badly placed ()'s. I am not sure if this right way to convert html to PDF, please help..I am using C-shell script
system ("../html2doc pdf 1000 portrait html$prnfile.html $prnfile.pdf ")
print "Content-type:application/pdf... (7 Replies)
Discussion started by: lakers646
7 Replies
LEARN ABOUT MOJAVE
getenv
GETENV(3) BSD Library Functions Manual GETENV(3)NAME
getenv, putenv, setenv, unsetenv -- environment variable functions
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdlib.h>
char *
getenv(const char *name);
int
setenv(const char *name, const char *value, int overwrite);
int
putenv(char *string);
int
unsetenv(const char *name);
DESCRIPTION
These functions set, unset and fetch environment variables from the host environment list.
The getenv() function obtains the current value of the environment variable, name. The application should not modify the string pointed to
by the getenv() function.
The setenv() function inserts or resets the environment variable name in the current environment list. If the variable name does not exist
in the list, it is inserted with the given value. If the variable does exist, the argument overwrite is tested; if overwrite is zero, the
variable is not reset, otherwise it is reset to the given value.
The putenv() function takes an argument of the form ``name=value'' and is equivalent to:
setenv(name, value, 1);
The string pointed to by string becomes part of the environment. A program should not alter or free the string, and should not use stack or
other transient string variables as arguments to putenv(). The setenv() function is strongly preferred to putenv().
The unsetenv() function deletes all instances of the variable name pointed to by name from the list. Note that only the variable name (e.g.,
"NAME") should be given; "NAME=value" will not work.
RETURN VALUES
The getenv() function returns the value of the environment variable as a NUL-terminated string. If the variable name is not in the current
environment, NULL is returned.
The setenv(), putenv(), and unsetenv() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable
errno is set to indicate the error.
ERRORS
[EINVAL] The function getenv(), setenv() or unsetenv() failed because the name is a NULL pointer, points to an empty string, or
points to a string containing an ``='' character.
The function putenv() failed because string is a NULL pointer or string is without an ``='' character.
[ENOMEM] The function setenv(), unsetenv() or putenv() failed because it was unable to allocate memory for the environment.
LEGACY SYNOPSIS
#include <stdlib.h>
void
unsetenv(const char *name);
unsetenv() doesn't return a value.
COMPATIBILITY
putenv() no longer copies its input buffer. This often appears in crash logs as a crash in getenv(). Avoid passing local buffers or freeing
the memory that is passed to putenv(). Use setenv(), which still makes an internal copy of its buffers.
unsetenv() no longer parses the variable name; e.g., unsetenv ("FOO=BAR") no longer works. Use unsetenv("FOO"). unsetenv() also now returns
a status value and will set errno to EINVAL if name is not a defined environment variable.
SEE ALSO csh(1), sh(1), execve(2), compat(5), environ(7)STANDARDS
The getenv() function conforms to ISO/IEC 9899:1990 (``ISO C90''). The setenv(), putenv() and unsetenv() functions conforms to IEEE Std
1003.1-2001 (``POSIX.1'').
HISTORY
The functions setenv() and unsetenv() appeared in Version 7 AT&T UNIX. The putenv() function appeared in 4.3BSD-Reno.
BUGS
Successive calls to setenv() that assign a larger-sized value than any previous value to the same name will result in a memory leak. The
FreeBSD semantics for this function (namely, that the contents of value are copied and that old values remain accessible indefinitely) make
this bug unavoidable. Future versions may eliminate one or both of these semantic guarantees in order to fix the bug.
BSD June 20, 2007 BSD