Display only files and folders that are symbolic links in tcsh or bash

后端 未结 11 964
灰色年华
灰色年华 2021-01-30 13:20

Basically I want do the following:

ls -l[+someflags]

(or by some other means) that will only display files that are symbolic links

so t

11条回答
  •  甜味超标
    2021-01-30 14:03

    Usage: foo $path

    Uses current path if none specified.

    #!/bin/bash
    
    case "$1" in
    
        -r)
        find $2 -type l -print | while IFS= read line ; do ls -l --color=always "$line"; done
        ;;
    
        --help)
        echo 'Usage: foo [-r] [$PATH]'
        echo    
        echo '-r  Recursive'
        ;;
    
    
        *)
        ls --color=always -ltra $1 | grep '\->'
    esac
    

提交回复
热议问题