Sponsored Content
Top Forums Shell Programming and Scripting expanding alias from a variable Post 302357302 by dr.house on Tuesday 29th of September 2009 10:19:50 AM
Old 09-29-2009
Code:
#! /bin/bash

echo -n "Server no.:  " ; read server
echo -n "Remote file: " ; read remote
echo -n "Local file:  " ; read local

echo "SCP:> $server $remote $local"

exit 0

Code:
[house@leonov] sh test.bash
Server no.:  12
Remote file: this
Local file:  that
SCP:> 12 this that

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expanding shell variable

I have a question about expanding shell variables. Given the following piece of script: a="Some text" b="Other text" for i in a b do string1=$i echo $string1 --> returns 'a' string2=EXPRESSION_WITH_$i echo $string2 --> returns 'Some text' done ... (2 Replies)
Discussion started by: lonar
2 Replies

2. UNIX for Dummies Questions & Answers

Alias with variable?

I'm new to UNIX. I have to run executables often, and they all have a common prefix "prefix_". Now I'm wondering if I can make an alias where I can type run xyz that will then execute "./prefix_xyz" ? Thanks in advance. (1 Reply)
Discussion started by: JustinT
1 Replies

3. Solaris

Variable not expanding during Solaris pkgadd

I'm having a little trouble with a Solaris package build/install. I have the following entries in my prototype file... # Interfaces file - all versions installed and auto linked to installation type... f none $OPTDIR/config/interfaces.DEV 0444 $OWNER $GROUP f none... (0 Replies)
Discussion started by: JerryHone
0 Replies

4. UNIX for Dummies Questions & Answers

Passing variable to Alias in Hp kshell

Hi all, I have a series of directories which i open regularly. I want create an alias so that i can pass the direcotry name to alias and then this commands makes Cd to the path i need. COuld you please help on how to create an alias ex of what i am trying but couldn't succeeded #alias... (1 Reply)
Discussion started by: firestar
1 Replies

5. UNIX for Dummies Questions & Answers

Create alias files (not alias commands)

If one: $ find -name 'some expression' -type f > newfile and then subsequently wants to create an alias file from each pathname the find command retrieved and the > placed within 'newfile', how would one do this? Ideally, the newly created alias files would all be in one directory. I am... (3 Replies)
Discussion started by: Alexander4444
3 Replies

6. Shell Programming and Scripting

awk alias passing a value to a variable

I am trying to turn this into an alias with no luck. I would then like to put the alias into my bashrc file. I know awk is very picky about quotes. I have tried every version of quotes, single quotes, double quotes, and backslashes that I can think of. VAR=$(xrandr | awk '$2=="connected"{s=$1}... (3 Replies)
Discussion started by: cokedude
3 Replies

7. Shell Programming and Scripting

use variable in alias

Hi Guys, aliase uniq get ut=XXX anistr|availyStus|oratate|uniqueid I want to create aliase but i want xxx as variable..... run like this uniq ak123 uniq ak324 uniq ak123 End of the story i want to use variable in aliase command (5 Replies)
Discussion started by: asavaliya
5 Replies

8. Shell Programming and Scripting

Quick question on expanding variable

s=`awk '{ print $0}' /Applications/Relink.app/z_cloudline.txt` sed -n '"$s"' /var/mobile/Library/iFile/Bookmarks.plist > /var/mobile/originalip.txt What is the problem with that code ? With variable it only outputs: sed: -e expression #1, char 1: unknown command: `"' If I use the... (3 Replies)
Discussion started by: pasc
3 Replies

9. Shell Programming and Scripting

Expanding a globed variable name

Heyas I'm trying to give some information on used variables. While the first two work fine, the ones starting with a glob (is that the proper term?) fail. echo ${!TUI_*} ${!RET_*} ${!*_CLI} ${!*\_GUI} bash: ${!*_CLI}: bad substitution Same with @ or have them escaped. I found no... (2 Replies)
Discussion started by: sea
2 Replies

10. UNIX for Beginners Questions & Answers

Sed variable not expanding

I have also some difficulty calling sed to change a word in a file. sed -i 's/docTitl/Outline ${docTitl}/g' $ofln Moved to new thread, since it is a different question (3 Replies)
Discussion started by: Danette
3 Replies
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.11 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 06:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy