Sponsored Content
Full Discussion: how to read a variable?
Top Forums Shell Programming and Scripting how to read a variable? Post 302311717 by mingming88 on Wednesday 29th of April 2009 10:54:39 AM
Old 04-29-2009
how to read a variable?

i want to ask how can i read a variable?

like
Code:
for i in 1 2 3
do
cat file${1} | while read something
do
if [ ]
echo " file name: file${i}" >>temp
else
echo ", file${i}" >>temp
done
done

it is not working, can i do something like that?

actually i want the output below
file name: file1, file2, file3

Last edited by mingming88; 04-29-2009 at 11:59 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Cannot read in variable using read on first try

Hi, My problem is : echo Division read vDivision variable1=`cut -c **something****' echo Do you want to proceed ? read ans I cant seem to read in ans on the first try and have to repeatedly enter the return key. If i remove the ` ` statement its ok but i need that line for... (1 Reply)
Discussion started by: normie
1 Replies

2. UNIX for Dummies Questions & Answers

Cant read in variable on first try

Hi, My problem is : echo Division read vDivision variable1=`cut -c **something****' echo Do you want to proceed ? read ans I cant seem to read in ans on the first try and have to repeatedly enter the return key. If i remove the ` ` statement its ok but i need that line for... (1 Reply)
Discussion started by: normie
1 Replies

3. Shell Programming and Scripting

How to read variable with no display

I'll be reading user name and password from the person while running a shell script so that he is authenticated. The challenge here is to read the password variable without displaying on screen. Is there a way? I presently do it displaying it on the screen as echo " please enter your... (9 Replies)
Discussion started by: dayanandra
9 Replies

4. Shell Programming and Scripting

Can I use read to read content of a variable

Can I use the read command to read the contents of a variable? I'm trying by using the following code and getting nothing back. I'm in a Linux environment. #!/bin/ksh IFS=~ VAR1=1~2~3~4 echo $VAR1 | read a b c d print "$a $b $c $d" (9 Replies)
Discussion started by: nmalencia
9 Replies

5. UNIX for Dummies Questions & Answers

How to read a file into a variable?

Hello, I have a ini-file containing comma-separated e-mail addresses, an bash-script sending a mail. Mail-addresses and the mail-script are separated, so I need not to change the important mail script. But how can I read out the file into a variable? It is possible to handover the mail... (7 Replies)
Discussion started by: ABE2202
7 Replies

6. Shell Programming and Scripting

want to read variable for the file

Hi, i have one file which has list of data like this xemp 42 yeet 87 wax 223 dyne 442 i want to read each of in for loop from the script can you give me syntax Use code tags, ty. (2 Replies)
Discussion started by: mail2sant
2 Replies

7. Shell Programming and Scripting

read variable after echo

Hi, i want to create an user-friendly script where you are asked for two numbers. i would like that these two number to be separated with "--" for example, but i can't figure out how to do this. for example read -p "Insert lowest and highest value: " min ; echo -n "-- "; read max so... (3 Replies)
Discussion started by: ezitoc
3 Replies

8. Shell Programming and Scripting

read variable substitution

Allright so a quick question. I'm building a script that will eventually do a full IP subnet scan. It starts off by first entering an IP address, (capturing host and net ID comes after that) and I want it to use the current IP address if no input is given. Is there a quick way to define the... (1 Reply)
Discussion started by: BisMarc
1 Replies

9. Linux

Use read to set a variable.

Hi all, I used to set variable by read from keyboard read -p 'Input new value for variable :' var Now I want to pipe from ls and set to var a.txt b.txt c.txt ls | grep a.txt | read var why this cannot set the $var. What is the different between them....:wall: (4 Replies)
Discussion started by: mainsun
4 Replies

10. Shell Programming and Scripting

Script read variable with for

Hi All, How I can read on variable with cycle for in bash script e.g.#!/bin/bash VAR1=`command1 sentence list` for i in $(cat $VAR1); do VAR2=`command2 $i` echo $VAR2 doneSo read VAR1 execute command over this and load in VAR2 then print VAR2, Thanks you, Please wrap... (1 Reply)
Discussion started by: aav1307
1 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 05:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy