| |

VerySource

 Forgot password?
 Register
Search
View: 1320|Reply: 8

Urgent ~ Help! ~ I'm a beginner and everyone helps! ~

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-18 22:00:01
| Show all posts |Read mode
Title: Use the variable assignment method to display the string DOS file c:>\$ student\*
Reply

Use magic Report

0

Threads

12

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 Invalid IP Address

Post time: 2020-1-26 05:00:01
| Show all posts
Basically scanf can do it ...
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-1-26 11:54:01
| Show all posts
Try to write by yourself
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-28 23:09:02
| Show all posts
#! / bin / sh
ddir = $ 1
shift
mv $ * $ ddir

The easiest way
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-29 11:09:02
| Show all posts
the other way

#! / bin / sh
ddir = $ 1
shift
if [! -e $ ddir -o! -w $ ddir]; then
echo "The dir is not found!"
return
fi
for file in $ *; do
if [-e $ file -a -r $ file]; then
mv $ file $ ddir
else
echo "the operation on file $ file is fail!"
fi
done
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-29 14:27:01
| Show all posts
There is no array form in the shell
The only thing is to split the string
#! / bin / sh
list = "a b c d"
for row in $ list; do

echo $ row

done
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 India

Post time: 2020-1-29 18:18:02
| Show all posts
#! / bin / sh
list = `ls -1 * .c`
ddir = "c"
#ddir Destination folder
for file in $ list; do
mv $ file $ ddir
done
cd $ ddir
ls -S * .c -1
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-30 01:00:02
| Show all posts
alias uuu = 'date'; pwd; who | wc -l '
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-15 01:15:01
| Show all posts
Pay attention to spaces, the shell is also very sensitive to spaces
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