Sponsored Content
Homework and Emergencies Homework & Coursework Questions BASH Environment Variables as arguments? Post 302394382 by vbe on Thursday 11th of February 2010 09:03:15 AM
Old 02-11-2010
You have it all in the problem statement: Think well...
Quote:
myenv PRINTER
should print a line such as: PRINTER=kc3500
e.g., myenv HOME PRINTER
should print a line such as: HOME=/home/dwoit
From the examples you must take in account only the 1rst given argument.
But this argument is also a variable, no?
So how will you print out the $1 if you dont store it in a variable ( call it DISPL_ENV) to display?
Why look for complicated syntax for something dead simple if you take the time to read what you are asked.
If you need more just post, but I do hope you find the solution by yourself now
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

what is the use of Environment variables

what is the actual use of environment variables. I know only PS1, LOGNAME, PS2 variables what are the other variables & what is there use (2 Replies)
Discussion started by: indianguru
2 Replies

2. Programming

environment variables

Hi! How-to get the environment variables in GNU. getenv() only fetches the ones that you can find under export (not the ones under declare)... best regars .David (2 Replies)
Discussion started by: Esaia
2 Replies

3. UNIX for Dummies Questions & Answers

environment variables

Hi Folks, Is it possible somehow to unset all the environment variables which have been defined before in UNIX (Solaris). Thanks, Slava (3 Replies)
Discussion started by: spavlov
3 Replies

4. UNIX for Dummies Questions & Answers

help..Environment variables...

hi, 1). i would like to know what is meant by environment variables? 2). is the number of envi variables is a constant number for unix systems? 3). how to see the list of envi variables (and the values of the envi variables)in a single command? 4). if this questions were already asked... (3 Replies)
Discussion started by: sekar sundaram
3 Replies

5. UNIX for Dummies Questions & Answers

Environment variables

why are all environment variables represented in a fixed format regardless of the shell you use? like $HOME $PATH etc (6 Replies)
Discussion started by: sravani
6 Replies

6. Shell Programming and Scripting

Unable to change environment variables in bash script

Hello! For the moment some settings in my .bashrc contain the password of my company's firewall, which is not a good idea. I would like to use the string "PASSWORD" set in .bashrc and a script that changes all appearances of "PASSWORD" in the environment variables by the actual password (which... (4 Replies)
Discussion started by: markolopa
4 Replies

7. Shell Programming and Scripting

Environment variables

I have read tons of posts about how you can't set persisting environment variable in a child script of a shell and have it persist. The only way is to source a file as % . <scriptname> I am finding that true... but I know there is a way around it. I just don't know how. I worked for 6... (5 Replies)
Discussion started by: rwa25
5 Replies

8. HP-UX

Environment Variables

Hi Experts, Need your help in understanding the commands to setup the environment variables in hp-ux. Beleive need to use either set,setenv or export. I am confused between above three options, when to use which option? On command line, I have tried both set and setenv but couldn't... (1 Reply)
Discussion started by: sai_2507
1 Replies

9. Shell Programming and Scripting

How to use ifdef for bash variables in csh environment?

Hi Guys, I have a a bash script and i am exporting a variable in it. I am calling a csh script from this bash script. The variable "ABC" will be visible in csh script. ks.bash export ABC = abc ./kp.csh ab.csh echo $ABC setenv ABC =cde (i want to assign this value to ABC only if... (4 Replies)
Discussion started by: vdhingra123
4 Replies

10. Shell Programming and Scripting

Sourcing .cshrc (C shell) environment variables to bash

I have tried with the following: csh -c 'source ~/.cshrc; exec bash' # works perfectly (cat ~/.cshrc; echo exec bash) | csh # not working And, using sed, I successfully retrieved the environment variables from ~/.cshrc sed -rn 's/setenv\s+(\S+)\s+(.*)$/export \1=\2/p' ~/.cshrc but now... (6 Replies)
Discussion started by: royalibrahim
6 Replies
LP(1)							    BSD General Commands Manual 						     LP(1)

NAME
lp -- front-end to the print spooler SYNOPSIS
lp [-cs] [-o option] [-d printer] [-n num] [file ...] DESCRIPTION
lp is a front-end to the print spooler as required by the IEEE Std 1003.2 (``POSIX.2'') specification. It effectively invokes lpr(1) with the proper set of arguments. It generally prints the named files on the destination printer. The following options are available: -c Make the lp command exit only after further access to any of the input files is no longer required. The application can then safely delete or modify the files without affecting the output operation. -d dest Specify a particular printer. If no -d is provided on the command line, the contents of the environment variables LPDEST or PRINTER (with this precedence) are taken as the destination printer. -n num Specify that num copies of each of the named files shall be printed. -s Silent operation. -o Printer specific options. Not supported, provided only as a compatibility option for SVR4. ENVIRONMENT
As described above, the variables LPDEST and PRINTER are examined to select the destination printer. SEE ALSO
lpr(1) STANDARDS
The lp command is expected to comply with the IEEE Std 1003.2 (``POSIX.2'') specification. AUTHORS
This implementation of the lp command has been written by Jorg Wunsch. BUGS
The IEEE Std 1003.2 (``POSIX.2'') specification does not provide any means to print non-text files. It rather requires the files to be printed to be text files limited to reasonable line lengths and printable characters. BSD
January 22, 1995 BSD
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy