简体   繁体   中英

Busybox SSH commands

Busybox on embedded Linux, SSH commands. Does rm command delete files in the current directory only, or in sub directories too? Here is directory structure:

<root@sample:/abc/1/demwr> ls -la
total 5
drwxr-xr-x    3 root     0                0 Jan  1 00:00 .
drwxr-xr-x    5 root     0                0 Jan  1 00:05 ..
-rwxrwxrwx    1 root     0              905 Jan  1 00:06 file1.der
drwxr-xr-x    2 root     0                0 Jan  1 00:00 download
lrwxrwxrwx    1 root     0               25 Jan  1 00:00 file2.der -> /abc/zw/kmc/file2.der
lrwxrwxrwx    1 root     0               28 Jan  1 00:00 file3.bin -> /abc/zw/kmc/file3.bin
-rwxrwxrwx    1 root     0             1052 Jan  1 00:06 file4.der
-rwxrwxrwx    1 root     0              140 Jan  1 00:02 file5.bin
lrwxrwxrwx    1 root     0               37 Jan  1 00:00 file6.bin -> /etc/qrstu/demwr/file6.bin

rm only deletes directories if you apply recursion to it ( -r ). You can check your busybox rm's version by running it with --help . With my busybox, it does have that capability:

$ busybox rm --help
BusyBox v1.21.0 (2013-12-08 07:54:36 PHT) multi-call binary.

Usage: rm [-irf] FILE...

Remove (unlink) FILEs

        -i      Always prompt before removing
        -f      Never prompt
        -R,-r   Recurse

To add: When you do rm * , the shell would first expand the glob pattern * and pass it to rm . Without -r , rm would only remove files passed to it and directories would be untouched.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM