Ticket #10: test-fish-ls.sh

File test-fish-ls.sh, 511 bytes (added by slavazanko, 10 years ago)
Line 
1#!/bin/sh
2
3dr=$(pwd)
4[ -n "$1" ] && dr=$1
5#LIST /$dr
6if ls -1 /$dr >/dev/null 2>&1 ; then
7    lsopts="-lan"
8    if ls -Q /$dr >/dev/null 2>/dev/null; then
9        lsopts=$lsopts"Q"
10    fi
11    ls $lsopts /$dr 2>/dev/null | grep '^[^cbt]' | (
12         while read p l u g s m d y n; do
13         echo "P$p $u.$g
14S$s
15d$m $d $y
16:${n}
17"
18        done
19    )
20    ls $lsopts /$dr 2>/dev/null | grep '^[cb]' | (
21        while read p l u g a i m d y n; do
22            echo "P$p $u.$g
23E$a$i
24d$m $d $y
25:${n}
26"
27        done
28    )
29    echo '### 200'
30else
31    echo '### 500'
32fi