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
printers(4)							   File Formats 						       printers(4)

NAME
printers - user-configurable printer alias database SYNOPSIS
$HOME/.printers DESCRIPTION
The $HOME/.printers file is a simplified version of the system /etc/printers.conf file. See printers.conf(4). Users create the $HOME/.printers file in their home directory. This optional file is customizable by the user. The $HOME/.printers file performs the following functions: 1. Sets personal aliases for all print commands. 2. Sets the interest list for the lpget, lpstat, and cancel commands. See lpget(1M), lpstat(1) and cancel(1). 3. Sets the default printer for the lp, lpr, lpq, and lprm commands. See lp(1), lpr(1B), lpq(1B), and lprm(1B). Entries Use a line or full screen editor to create or modify the $HOME/.printers file. Each entry in $HOME/.printers describes one destination. Entries are one line consisting of two fields separated by either BLANKs or TABs and terminated by a NEWLINE. Format for an entry in $HOME/.printers varies according to the purpose of the entry. Empty lines can be included for readability. Entries may continue on to multiple lines by adding a backslash (`') as the last character in the line. The $HOME/.printers file can include comments. Comments have a pound sign (`#') as the first character in the line, and are ter- minated by a NEWLINE. Setting Personal Aliases Specify the alias or aliases in the first field. Separate multiple aliases by a pipe sign (`|'). Specify the destination in the second field. A destination names a printer or class of printers, See lpadmin(1M). Specify the destination using atomic or POSIX-style (server:destination) names. See printers.conf(4) for information regarding the naming conventions for atomic names, and standards(5) for information regarding POSIX. Setting the Interest List for lpget, lpstat and cancel Specify _all in the first field. Specify the list of destinations for the interest list in the second field. Separate each destinations by a comma (`,'). Specify destinations using atomic or POSIX-style (server:destination) names. See printers.conf(4) for information regarding the naming conventions for atomic and names. This list of destinations can refer to an alias defined in $HOME/.printers. Setting the Default Destination Specify _default in the first field. Specify the default destination in the second field. Specify the default destination using atomic or POSIX-style (server:destination) names. See printers.conf(4) for information regarding the naming conventions for atomic names. The default destination may refer to an alias defined in $HOME/.printers. Locating Destination Information The print client commands locate destination information based on the "printers" database entry in the /etc/nsswitch.conf file. See nss- witch.conf(4). Locating the Personal Default Destination The default destination is located differently depending on the command. The lp command locates the default destination in the following order: 1. lp command's -d destination option. 2. LPDEST environment variable. 3. PRINTER environment variable. 4. _default destination in $HOME/.printers. 5. _default destination in /etc/printers.conf. The lpr, lpq, and lprm commands locate the default destination in the following order: 1. lpr command's -P destination option. 2. PRINTER environment variable. 3. LPDEST environment variable. 4. _default destination in $HOME/.printers. 5. _default destination in /etc/printers.conf. Locating the Interest List for lpget, lpstat, and cancel The lpget, lpstat, and cancel commands locate the interest list in the following order: 1. _all list in $HOME/.printers. 2. _all list in /etc/printers.conf. EXAMPLES
Example 1: Setting the interest list The following entry sets the interest list to destinations ps, secure, and dog at server west and finance_ps: _all ps,secure,west:dog/finance_ps Example 2: Setting aliases to a printer The following entry sets the aliases ps, lp, and lw to sparc_printer: ps|lp|lw sparc_printer Example 3: Setting an alias as a default destination The following entry sets the alias pcl to hplj and sets it as the default destination: pcl|_default hplj Example 4: Setting an alias to a server destination The following entry sets the alias secure to destination catalpa at server tabloid: secure tabloid:catalpa Example 5: Setting an alias to a site destination The following entry sets the alias insecure to destination legal_ps: insecure legal_ps FILES
$HOME/.printers User-configurable printer database. /etc/printers.conf System printer configuration database. printers.conf.byname NIS version of /etc/printers.conf. printers.org_dir NIS+ version of /etc/printers.conf. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpcu | +-----------------------------+-----------------------------+ |Stability Level |Stable | +-----------------------------+-----------------------------+ SEE ALSO
cancel(1), lp(1), lpq(1B), lpr(1B), lprm(1B), lpstat(1), lpadmin(1M), lpget(1M), nsswitch.conf(4), printers.conf(4), attributes(5), stan- dards(5) System Administration Guide: Basic Administration NOTES
$HOME/.printers is referenced by the printing commands before further name resolution is made in /etc/printers.conf or the name service. If the alias references a destination defined in /etc/printers.conf, it is possible that the destination is defined differently on differ- ent systems. This could cause output to be sent to an unintended destination if the user is logged in to a different system. SunOS 5.10 23 May 2003 printers(4)
All times are GMT -4. The time now is 12:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy