Engineering and technology notes

read Man Page – Linux

ead

Read one line from the standard input, (or from a file) and assign the word(s) to variable name(s).

Syntax
read [-ers] [-a aname] [-p prompt] [-t timeout] [-n nchars] [-d delim] [name…]

Key
-a aname
The words are assigned to sequential indices of the array variable aname, starting at 0.
aname is unset before any new values are assigned. Other name arguments are ignored.

-d delim
The first character of delim is used to terminate the input line, rather than newline.

-e If the standard input is coming from a terminal, readline is used to obtain the line.

-n nchars
read returns after reading nchars characters rather than waiting for a complete line of
input.
-p prompt
Display prompt on standard error, without a trailing newline, before attempting to read
any input. The prompt is displayed only if input is coming from a terminal.

-r Backslash does not act as an escape character. The backslash is considered to be part
of the line. In particular, a backslash-newline pair can not be used as a line continuation.

-s Silent mode. If input is coming from a terminal, characters are not echoed.

-t timeout
Cause read to time out and return failure if a complete line of input is not read
within timeout seconds. This option has no effect if read is not reading input from
the terminal or a pipe.

-u fd Read input from file descriptor fd.

This is a BASH shell builtin, to display your local syntax from the bash prompt type: help [r]ead

One line is read from the standard input, and the first word is assigned to the first name, the second word to the second name, and so on, with leftover words and their intervening separators assigned to the last name.

If there are fewer words read from the standard input than names, the remaining names are assigned empty values.

The characters in the value of the IFS variable are used to split the line into words.

The backslash character `\’ can be used to remove any special meaning for the next character read and for line continuation.

If no names are supplied, the line read is assigned to the variable REPLY. The return code is zero, unless end-of-file is encountered or read times out.

Examples

#!/bin/bash
read var_year
echo “The year is: $var_year”

echo -n “Enter your name and press [ENTER]: ”
read var_name
echo “Your name is: $var_name”

Source: read Man Page – Linux – SS64.com

terminal + ssh doesn’t display UTF correctly – Ask Ubuntu

I have a remote server, to which I connect via SSH.

On separate Mac OS and Gentoo computers, when I connect to this server, unicode works fine. On my brand new Ubuntu installation, I don’t see unicode on this server correctly and I can’t seem to insert them correctly either.

I have a file with a letter “ž”. When I less it locally, on Ubuntu, in Terminal, I see correct “ž”. When I less the same file on the aforementioned server via SSH, I see just – both in Terminal and xterm.

locale on the server shows me this

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=”en_US.UTF-8″
LC_NUMERIC=cs_CZ.UTF-8
LC_TIME=cs_CZ.UTF-8
LC_COLLATE=”en_US.UTF-8″
LC_MONETARY=cs_CZ.UTF-8
LC_MESSAGES=”en_US.UTF-8″
LC_PAPER=cs_CZ.UTF-8
LC_NAME=cs_CZ.UTF-8
LC_ADDRESS=cs_CZ.UTF-8
LC_TELEPHONE=cs_CZ.UTF-8
LC_MEASUREMENT=cs_CZ.UTF-8
LC_IDENTIFICATION=cs_CZ.UTF-8
LC_ALL=

Terminal has UTF8 encoding (and as I wrote, the unicode file is opened correctly when opened locally).

What can be wrong?
ssh gnome-terminal unicode
shareimprove this question
asked Feb 17 ’14 at 0:28
Karel Bílek
79431023
add a comment
1 Answer
active
oldest
votes
9

This answer to a similar question helped

https://askubuntu.com/a/144448/9685

Commenting out SendEnv LANG LC_* in the local /etc/ssh/ssh_config file fixed everything.
shareimprove this answer
edited Apr 13 ’17 at 12:25
Community♦
1
answered Feb 17 ’14 at 0:37
Karel Bílek
79431023

add a comment
 

Source: terminal + ssh doesn’t display UTF correctly – Ask Ubuntu

ssh through second network card using PUTTY – Google Groups

Hi,I am using Putty and want to open a ssh using a second network card,

I can find no settings whereby the second card can be selected.

I have the following settings
Running Win7
Ethernet adapter Local Area Connection 2:

Connection-specific DNS Suffix  . :
IP Address. . . . . . . . . . . . : 192.168.1.170
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix  . :
IP Address. . . . . . . . . . . . : 10.0.0.5
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . : 10.0.0.1

Is there something that I am missing.

Another option would be to use telnet session, but I can also find no way of
forcing the telnet to go through the second card.

Thanks in advance

——————————————————————————

    AFAIK there is no way  in putty you can select  an  interface before opening
a SSH connection. One way to do this is to change the network interface “metric”
value. Just increase the “interface 1” metric value and W2K will start using the
interface 2 for all the network activity.

To change the metric do the following

Right click on the “My Network Places” -> right click on  the “Local Area
Connection” -> select properties ->select Internet Protocol (TCP/IP) ->select
properties-> click on advanced and change value of interface metric to “2”.
Click on “OK” .

Now putty (in fact all the apps) should start using the second interface for all the new connections.

Source: ssh through second network card using PUTTY – Google Groups