Sponsored Content
Full Discussion: arguments in sourcing file
Top Forums UNIX for Dummies Questions & Answers arguments in sourcing file Post 54690 by GSalisbury on Friday 20th of August 2004 03:57:05 PM
Old 08-20-2004
In csh when you source another script it's running in your current context.
That's why source xxx arg doesn't get you what you want.
You'd have to either do:
set argv=( "blah1" "blah2"...)
then
source xxx (it would then 'see' the $1)
or
set abc="blah..."
then
source xxx (and it would have to access $abc)
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sourcing the .bashrc

Hello, I am quite new to Linux... I need to set some aliases and I can't get it to work. Can somebody tell me what's wrong? I modified the .bashrc file in my home directory. I added: alias pmv= '/home/vera/MGLTools-1.4.5/share/bin/pmv' saved it and ran source .bashrc The shell... (3 Replies)
Discussion started by: Nusy
3 Replies

2. Shell Programming and Scripting

Help with Nested Sourcing files.

Hi, I have a script #!/bin/ksh #reading parameters. . FileA Echo ...... ...... File A has all parameters. FileA: Infile=xyz.com outfile=abc.com #Userid file . FileB FileB: (2 Replies)
Discussion started by: pinnacle
2 Replies

3. Shell Programming and Scripting

sourcing .profile for other users

Hi Team, Thank you for your time. i have a situation where the user IDs of the applicatio users have been locked down to Read only. Hence I am writing a script to invoke their old .profile every time they login. My problem is : when i run . $userpath/.profile from within the ksh script... (9 Replies)
Discussion started by: anitha111
9 Replies

4. Red Hat

Crontab sourcing PATH?

Hi, Im trying to run script A which requires path /sbin. I have a crontab entry to run script A every 10 minutes. Script A is executed fine by cron, but because script A requires /sbin in its path it fails to run. My situation is script A get overwritten from time to time so I can't modify... (4 Replies)
Discussion started by: wilsonee
4 Replies

5. Shell Programming and Scripting

Sourcing as root automatically

Hey everyone! I have my .bash_profile file which is read automatically when I launch Terminal therefore I can run my own functions. BUT. When I do: sudo -s sudo su sudo su - No matter what I do, I can't get the .bash_profile file to be sourced automatically so I end up having to run... (2 Replies)
Discussion started by: dasx
2 Replies

6. Shell Programming and Scripting

Sourcing variables from another script

My manager required that i keep the hostnames and username and password in a separate file when creating my sftp script. (Don't mention passwords and sftp...I've talk to him about this several times) I have a list of hostnames that have to be read in a loop in my main script. I don't know... (3 Replies)
Discussion started by: MJCreations
3 Replies

7. UNIX for Dummies Questions & Answers

Question On Sourcing Variables

I have 2 scripts first script would call second script. test1.sh #!/bin/bash logfile=`basename $0`.log echo "First File" >> $logfile TIME=`ls -lu array.ksh | awk '{print $6" "$7" "$8}'` . /home/infrmtca/bin/Test/test2.sh #/home/infrmtca/bin/Test/test2.sh test2.sh #!/bin/bash... (1 Reply)
Discussion started by: Ariean
1 Replies

8. Shell Programming and Scripting

Sourcing Env file with eval works with ksh but not BASH

Hi, I am running this on Redhat 5.10 I have a simple test script called test.sh which has the following contents and it uses the BASH shebang. ------------------------------------------------------------- #!/bin/bash eval `/tmp/filereader.pl /tmp/envfile.txt` echo "TESTPATH=$TESTPATH" ... (28 Replies)
Discussion started by: waavman
28 Replies

9. Shell Programming and Scripting

Issue with sourcing a file

I have a issue.sh script more issue.sh #!/bin/bash -e echo "start" source ~/.moht echo "end" Contents of ~/.moht are as below more ~/.moht umask 022 export EDITOR=vi SYSNM=`uname -n` UID=`id` HOST=`hostname` Executing of issue.sh throws the below error (1 Reply)
Discussion started by: mohtashims
1 Replies

10. UNIX for Beginners Questions & Answers

Sourcing file from parent directory bash

"Debian 9 64x - LXDE" I try to source a file from my parent directory: #!/bin/bash #source.bash . ../links.bash but i get "file not found". I tried . "../links.bash" and . '../links.bash'. I got on all methods the same result. If i use the absolute path it works, but i don't want to... (4 Replies)
Discussion started by: int3g3r
4 Replies
xstr(1) 							   User Commands							   xstr(1)

NAME
xstr - extract strings from C programs to implement shared strings SYNOPSIS
xstr -c filename [-v] [-l array] xstr [-l array] xstr filename [-v] [-l array] DESCRIPTION
xstr maintains a file called strings into which strings in component parts of a large program are hashed. These strings are replaced with references to this common area. This serves to implement shared constant strings, which are most useful if they are also read-only. The command: example% xstr -c filename extracts the strings from the C source in name, replacing string references by expressions of the form &xstr[number] for some number. An appropriate declaration of xstr is prepended to the file. The resulting C text is placed in the file x.c, to then be compiled. The strings from this file are placed in the strings data base if they are not there already. Repeated strings and strings which are suffixes of existing strings do not cause changes to the data base. After all components of a large program have been compiled, a file declaring the common xstr space called xs.c can be created by a command of the form: example% xstr This xs.c file should then be compiled and loaded with the rest of the program. If possible, the array can be made read-only (shared) sav- ing space and swap overhead. xstr can also be used on a single file. A command: example% xstr filename creates files x.c and xs.c as before, without using or affecting any strings file in the same directory. It may be useful to run xstr after the C preprocessor if any macro definitions yield strings or if there is conditional code which contains strings which may not, in fact, be needed. xstr reads from the standard input when the argument `-' is given. An appropriate command sequence for running xstr after the C preprocessor is: example% cc -E name.c | xstr -c - example% cc -c x.c example% mv x.o name.o xstr does not touch the file strings unless new items are added; thus make(1S) can avoid remaking xs.o unless truly necessary. OPTIONS
-c filename Take C source text from filename. -v Verbose: display a progress report indicating where new or duplicate strings were found. -l array Specify the named array in program references to abstracted strings. The default array name is xstr. FILES
strings data base of strings x.c massaged C source xs.c C source for definition of array "xstr*(rq /tmp/xs* temp file when xstr filename doesn't touch strings ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
make(1S), attributes(5) BUGS
If a string is a suffix of another string in the data base, but the shorter string is seen first by xstr both strings will be placed in the data base, when just placing the longer one there would do. NOTES
Be aware that xstr indiscriminately replaces all strings with expressions of the form &xstr[number] regardless of the way the original C code might have used the string. For example, you will encounter a problem with code that uses sizeof() to determine the length of a lit- eral string because xstr will replace the literal string with a pointer that most likely will have a different size than the string's. To circumvent this problem: o use strlen() instead of sizeof(); note that sizeof() returns the size of the array (including the null byte at the end), whereas strlen() doesn't count the null byte. The equivalent of sizeof("xxx") really is (strlen("xxx"))+1. o use #define for operands of sizeof() and use the define'd version. xstr ignores #define statements. Make sure you run xstr on file- name before you run it on the preprocessor. You will also encounter a problem when declaring an initialized character array of the form char x[] = "xxx"; xstr will replace xxx with an expression of the form &xstr[number] which will not compile. To circumvent this problem, use static char *x = "xxx" instead of static char x[] = "xxx". SunOS 5.10 14 Sep 1992 xstr(1)
All times are GMT -4. The time now is 02:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy