Sponsored Content
Top Forums Shell Programming and Scripting New to SSH and looking for short talk Post 302956159 by Aia on Sunday 27th of September 2015 05:45:48 PM
Old 09-27-2015
root@server [~]# grep -o '/home/[Aa-Zz]*' /etc/passwd/home/deerlet
The blue pertains to the shell
The purple pertains to the command issued, in this case grep

root@server [~]# This part is the prompt message (visual clue). This part is setup by the shell you are using at the time of login. In the bash shell (for example) it is recorded in the environment variable $PS1. However, it can be influenced or modified by the variable $PROMPT_COMMAND. It can have literally any message.
You can see the values of these variable by issuing the commands:
Code:
echo $PS1

Code:
echo $PROMPT_COMMAND

In this case, by convention the interpretation means:
root : the name of the user currently using the shell, it can be set in PS1 with the alias short-hand \u, in bash
@ : at
server: host name logged in; it can be set in PS1 with the shot-hand alias \h in bash
space [~]: cosmetic look; the ~ represents the home path of the currently logged user; it dynamically changes if set in PS1 with a \w or \W
# : A symbol to represent the superuser at the helm. It is convention. A regular user might have the symbol % or $. But there's nothing that said that it has to be anything.

The grep command:
-o : a flag to make grep just output the matched pattern, instead of the line where found.
'/home/[Aa-Zz]*' : BRE (Basic Regular Expression) pattern, it is surrounded by single quotes to tell the shell not to try to interpreted the content and passed to grep as it.
[Aa-Zz] : Character class; The A and lower z are redundant since the range a-Z converts them. [a-Z] does the same.
* : Meta character; it means match zero or more of the previous character. Do not confuse with the shell glob (*) character that exist in the shell.

/etc/passwd/home/deerlet : path of the file that grep will read, in order to try to find lines that match the pattern previously mentioned.

Last edited by Aia; 09-27-2015 at 10:35 PM.. Reason: corrects misword.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Talk utility

Are "talk" sessions logged or can they be logged? (1 Reply)
Discussion started by: pbonilla
1 Replies

2. UNIX for Advanced & Expert Users

apple talk

Does anyone know how to route apple talk through a bridged connection ? :eek: (1 Reply)
Discussion started by: maxamaynard
1 Replies

3. UNIX for Dummies Questions & Answers

Talk not working

Hi, I am trying talk but it isn't working. I tried talk ip terminal talk ip:terminal First it says: Then after 2 seconds I have checked the mesg status: Its y I am not getting any invitation on the other machine. Thanks in Advance (1 Reply)
Discussion started by: vibhor_agarwali
1 Replies

4. IP Networking

UNIX talk

I have the manpage for this utility on my system, but the utility itself is not there. My friend has the utility, but it does not work, not even on the same machine. Does anyone remember it? What software package is it related to? Where is it configured? (1 Reply)
Discussion started by: Corona688
1 Replies

5. Shell Programming and Scripting

talk command to chat

Hi, Could you please advice on the following query: There are 2 users on a unix box: 1. aaaa 2. bbbb I open 2 putty sessions and login with the above 2 users. Then I type the following using the aaaa user to chat with bbbb. talk bbbb or talk bbbb@hostname Result: the screen goes... (1 Reply)
Discussion started by: miltonkeynesguy
1 Replies

6. Shell Programming and Scripting

problems with using talk command

using talk option i tried to send message to my team mate. for connecting to one unix box, we are having a common userid and password except that, the ip addresses will change for me it is x.x.x.4, for my colleague it is x.x.x.3 These are the steps i did > who <userid> pts/2 ... (1 Reply)
Discussion started by: trichyselva
1 Replies

7. What is on Your Mind?

Anybody want to talk about Krack?

At face value this looks bad for Android 6 and Linux. Wi-fi security flaw 'puts devices at risk of hacks' - BBC News (1 Reply)
Discussion started by: hicksd8
1 Replies

8. Programming

Bridging Talk

Hi! I would like to start creating a bridge for good old Unix talk program. This bridge would allow you to joinIRC-channel by using talk just for example. I have a couple of questions: 1. Are there any previous attempts or implementations creating Talk bridge? 2. Which version of the talk... (9 Replies)
Discussion started by: homebeach
9 Replies
All times are GMT -4. The time now is 02:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy