10-27-2008
usage of echo with standard input
Hi,
I am passing the file filename to a program and I have to use the "<" sign:
program < filename
Inside the program I would like to assign the string "filename" to a variable var.
I can't do that with "var=$(echo $1)" because of the "<" sign.
Removing the "<" sign would work for echo, but not for the rest of the program.
Can someone help me sorting this out, using echo or whatever command is suitable?
Cheers
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how can i redirect standard input? i dont remember :/, though could you redirec not from a command? i mean, to redirect always stdin and stout (1 Reply)
Discussion started by: Jariya
1 Replies
2. Shell Programming and Scripting
I tried copy the output files from find command into a directory.
Example,
find / -name core 2>/dev/null | xargs cp????
I have known that we can use xargs to execute command lines from standard input but how to use it in this case.
Or I can do something besides xargs. (2 Replies)
Discussion started by: lalelle
2 Replies
3. Shell Programming and Scripting
Dear...
I have a scrpit that contains multiple read command.... when I run the script I have to enter 3 variables so that I can get the output..
but, I dont want to put those 3 inputs manually every time... I want to make a shell that reads the 3 inputs from a file.
the script name is... (4 Replies)
Discussion started by: yahyaaa
4 Replies
4. Shell Programming and Scripting
Hi All,
How do I provide the output of a command to another command which is waiting for an input from the user ?
Ex : I need to login to a device via telnet. In the script, initially I use the "read" command to get the IP Address, Username and Password of the device from the user. Now,... (1 Reply)
Discussion started by: sushant172
1 Replies
5. Solaris
Please give me any example for standard input in Solaris. (6 Replies)
Discussion started by: karman0931
6 Replies
6. Shell Programming and Scripting
Hello,
I'm writting a korn script that executes a daemon in a remote server. The problem is that daemon doesn't go background until it receives an enter from the standard input, and it maintains the rsh opened until it get it. I'm looking for the best (efficient and elegant) way to do send the... (3 Replies)
Discussion started by: nefeli
3 Replies
7. Shell Programming and Scripting
Hello,
I am new to scripting.
How do I read multiple lines from the command line?
I know read reads one line, but if I have to read multiple lines, how should I do?
Thanks,
Prasanna (4 Replies)
Discussion started by: prasanna1157
4 Replies
8. Shell Programming and Scripting
So, I am new to shell scripting and have a few problems.
I know how to read from standard input but I do not know how to really compare it to say, a character. I am trying to compare it to a character and anything exceeding just a character, the user will get an output message, but the program... (7 Replies)
Discussion started by: Bungkai
7 Replies
9. Shell Programming and Scripting
I have a program that requires the user to enter input values while it is being run
for example in bash
...
...
..
echo "Enter your input"
read input
echo $input
...
...
...I need to schedule this program with crontab, hence a problem, cronjobs run in the background, any ideas on how to... (10 Replies)
Discussion started by: walforum
10 Replies
10. Homework & Coursework Questions
Just started learning Unix and received my first assignment recently. We haven't learned many commands and honestly, I'm stumped. I'd like to receive assistance/guidance/hints.
1. The problem statement, all variables and given/known data:
How do I write a shell script that takes in a file or... (4 Replies)
Discussion started by: fozilla
4 Replies
LEARN ABOUT SUNOS
scr_restore
scr_dump(3XCURSES) X/Open Curses Library Functions scr_dump(3XCURSES)
NAME
scr_dump, scr_init, scr_restore, scr_set - write screen contents to/from a file
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 scr_dump(const char *filename);
int scr_init(const char *filename);
int scr_restore(const char *filename);
int scr_set(const char *filename);
PARAMETERS
filename Is a pointer to the file in which screen contents are written.
DESCRIPTION
These function perform input/output functions on a screen basis.
The scr_dump() function writes the contents of the virtual screen, curscr, to filename.
The scr_restore() function reads the contents of filename from curscr (which must have been written with scr_dump()). The next refresh
operation restores the screen to the way it looks in filename.
The scr_init() function reads the contents of filename and uses those contents to initialize the X/Open Curses data structures to what is
actually on screen. The next refresh operation bases its updates on this data, unless the terminal has been written to since filename was
saved or the terminfo capabilities rmcup and nrrmc are defined for the current terminal.
The scr_set() function combines scr_restore() and scr_init(). It informs the program that the contents of the file filename are what is
currently on the screen and that the program wants those contents on the screen.
RETURN VALUES
On success, these functions return OK. Otherwise, they return ERR.
ERRORS
None.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO
delscreen(3XCURSES), doupdate(3XCURSES), endwin(3XCURSES), getwin(3XCURSES), libcurses(3XCURSES), attributes(5), standards(5)
SunOS 5.10 5 Jun 2002 scr_dump(3XCURSES)