Sponsored Content
Top Forums UNIX for Advanced & Expert Users Expanding Variables in User Input Post 87149 by Bsk on Thursday 20th of October 2005 12:39:46 PM
Old 10-20-2005
Expanding Variables in User Input

If have
var='$variable'
how can I expand $variable.
I have tried many thing like duble quotes/braces etc, but nothing worked.
I need the solution ASAP.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Expanding variables with Ed Bash 3.2.33

Hi, The following code finds the line containing fruits in test.txt and replaces instances of apple with banana. ed -s test.txt <<< $'/fruits/s/apple/banana/g\nw' What I want to do is put variables in the place of fruits, apple and banana. I have tried replacing ' with " to get... (2 Replies)
Discussion started by: de_la_espada
2 Replies

2. Shell Programming and Scripting

How to automatically create variables from user input in ksh?

I need some help to write a ksh script. My code so far (pretty bad, sorry): #! /bin/ksh echo "Calculate average" UserDecision=y while test $UserDecision = y do echo "Enter a number: " read Number1 echo "Enter a number: " read Number2 echo "Do you want to enter another number?... (2 Replies)
Discussion started by: johnagar
2 Replies

3. Shell Programming and Scripting

How to get the user input recursively until the user provides valid input

Hi, echo "Enter file name of input file list along with absolute path : " read inputFileList if then for string in `cat inputFileList` do echo $string done else echo " file does not exist" fi From the above code, if the user enters a invalid file... (1 Reply)
Discussion started by: i.srini89
1 Replies

4. Shell Programming and Scripting

awk issue expanding variables in ksh script

Hi Guys, I have an issue with awk and variables. I have trawled the internet and forums but can't seem to get the exactt syntax I need. I have tried using awk -v and all sorts of variations but I have hit a brick wall. I have spent a full day on this and am just going round in circles. ... (3 Replies)
Discussion started by: gazza-o
3 Replies

5. Shell Programming and Scripting

Script interacts with user , based on user input it operates

i have a script which takes input from user, if user gives either Y/y then it should continue, else it should quit by displaying user cancelled. #!/bin/sh echo " Enter your choice to continue y/Y OR n/N to quit " read A if then echo " user requested to continue " ##some commands... (7 Replies)
Discussion started by: only4satish
7 Replies

6. Shell Programming and Scripting

Doing math using user defined input and system environment variables

Hi, I need some help to setup some environmental variables. for example...Get A -> userdefined/user input B -> a number. c -> system variable...for example $GETCONF PAGE_SIZE E = do some math using bc display a message "The value is E" setup the system/kernel paramter sysctl -p... (3 Replies)
Discussion started by: saravanapandi
3 Replies

7. Shell Programming and Scripting

User input and run awk using the input

I am trying to allow a user to enter in text and then store that text in a variable $gene to run in an awk command in which those values are used to run some calculations. I am getting syntax errors however, when I try. Thank you :). The awk runs great if it is a pre-defined file that is used,... (7 Replies)
Discussion started by: cmccabe
7 Replies

8. Shell Programming and Scripting

Possible ksh93 Bug Expanding Variables?

My OS is Linux (kernel 4.08.something) and AIX (7100-04-01-1543), the used ksh versions are: ksh88: Version M-11/16/88f (AIX) ksh93: Version M 93t+ 2009-05-01 (AIX), Version M 93u (Linux) When writing a parser for stanza files in ksh i encountered a rather strange behavior. Here is a... (4 Replies)
Discussion started by: bakunin
4 Replies

9. Shell Programming and Scripting

For in loop - two input variables

When I create a newfile, I am using the filename as a variable to create the new filename. When I ouput it, the filename contains the file extension in the middle of the file example: router1.txtshcdpneighbors.txt router2.logshcdpneighbors.txt My initial approach was to strip it out, now I... (2 Replies)
Discussion started by: dis0wned
2 Replies

10. UNIX for Beginners Questions & Answers

[BASH] eval command not expanding variables as expected.

Hi Guys, I wrote a collection of bash functions years ago and now need to use them again but I'm getting some error messages when eval tries to expand the variables names. I recollect that I used the shopt command to set one of the options but I can't quite remember the command that I... (8 Replies)
Discussion started by: ASGR
8 Replies
KPSEWHICH(1)						      General Commands Manual						      KPSEWHICH(1)

NAME
       kpsewhich - standalone path lookup and and expansion for kpathsea

SYNOPSIS
       kpsewhich [options] [filenames]

DESCRIPTION
       This manual page is not meant to be exhaustive.	The complete documentation for this version of TeX can be found in the info file or manual
       Kpathsea: A library for path searching.

       kpsewhich is used as a standalone front-end of the kpathsea library that can be used to examine variables and find files.  When the -format
       option is not given, the search path used when looking for a file is inferred from the name given, by looking for a known extension.  If no
       known extension is found, the search path for TeX source files is used.

OPTIONS
       kpsewhich accepts the following options:

       -debug num
	      Set debugging flags.

       -D num Use a base resolution of num; the default, set by the installer, is typically 600.

       -dpi num
	      As -D.

       -engine string
	      Set $engine in the environment, which is used in some search paths.

       -expand-braces string
	      Print variable and brace expansion of string.

       -expand-path string
	      Print complete path expansion of string.

       -expand-var string
	      Print variable expansion of string.

       -format name
	      Use file type name.  See the info manual for a list of valid names, or use the -help option to print the list.

       -help  Print help message and exit.

       -interactive
	      Ask for additional filenames to look up.

       -mktex fmt
	      enable mktexfmt generation.  (fmt=pk/mf/tex/tfm)

       -mode string
	      Set device name for $MAKETEX_MODE to string; no default.

       -must-exist
	      Search the disk as well as ls-R if necessary.

       -no-mktex fmt
	      disable mktexfmt generation.  (fmt=pk/mf/tex/tfm)

       -path string
	      Search in the path string.

       -progname string
	      Set program name to string.

       -show-path name
	      Output search path for file type name.  See the info manual for a list of valid names, or use the -help option to print the list.

       -var-value variable
	      Print the expansion of variable.

       -version
	      Print version information and exit.

SEE ALSO
       mktexlsr(1), mktexmf(1), mktexpk(1), mktextfm(1).

Kpathsea 6.1.0							   1 March 2011 						      KPSEWHICH(1)
All times are GMT -4. The time now is 08:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy