| |

VerySource

 Forgot password?
 Register
Search
View: 1169|Reply: 4

Write a shell script that displays the date of the day to find if a given user is working in the system. If he is in the

[Copy link]

2

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-23 10:40:01
| Show all posts |Read mode
Write a shell script that displays the date of the day to find if a given user is working in the system. If he is in the system, send him a greeting
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-5-5 22:45:02
| Show all posts
date '+% Y% m% d
if
  who | grep "^ $ 1"
then
  write $ 1 <<!
hello
!
fi
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-13 19:30:02
| Show all posts
The first line upstairs is missing a single quote, ha ha
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-2 19:45:01
| Show all posts
[code=C/C++]
    +1 #FileName:Hello.sh
    +2 #! /dev/sh -x
    +3 date'+%Y%m%d'
    +4 echo "Please enter the access user Default: NULL"
    +5 read Username
    +6 w|grep ${Username}&&write ${Username}
    +7 hello
    +8 ![/code]
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-2 20:15:01
| Show all posts
[code=Python]
#!/bin/bash
IS_USER_FOUND=0
date +%F

if who | grep "^$1 "; then
IS_USER_FOUND=1;
    write $1 <<Limitstring
hello
Limitstring
fi

if [$IS_USER_FOUND -eq "0"]
then
echo "user $1 not found."
fi
[/code]
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list