Ticket #2092: mc.menu.hardlink-example

File mc.menu.hardlink-example, 1.1 KB (added by Wiseman1024, 9 years ago)
Line 
1shell_patterns=0
2
3+ ! t t & ! f ^\.\.$
4l   Hardlink file(s)
5    for DST in whiptail dialog gdialog Xdialog; do #kdialog is not fully compatible with this
6        if [ -x /usr/bin/$DST ]; then
7            CMD=$DST
8            break 1
9        fi
10    done
11    $CMD --inputbox 'Hardlink file to:' 8 64 %D/ 2>${MC_TMPDIR-/tmp}/__dialog-tmp__
12    DST="`cat ${MC_TMPDIR-/tmp}/__dialog-tmp__`"
13    rm ${MC_TMPDIR-/tmp}/__dialog-tmp__
14    if [ "x$DST" != x ]; then
15        cp -Rli %f "$DST"
16    fi
17    unset CMD
18    unset DST
19
20+ t t
21l   Hardlink file(s)
22    for DST in whiptail dialog gdialog Xdialog; do #kdialog is not fully compatible with this
23        if [ -x /usr/bin/$DST ]; then
24            CMD=$DST
25            break 1
26        fi
27    done
28    $CMD --inputbox 'Hardlink file(s) to:' 8 64 %D/ 2>${MC_TMPDIR-/tmp}/__dialog-tmp__
29    DST="`cat ${MC_TMPDIR-/tmp}/__dialog-tmp__`"
30    rm ${MC_TMPDIR-/tmp}/__dialog-tmp__
31    if [ "x$DST" != x ]; then
32        if [ -d "$DST" ]; then
33            cp -Rli %u "$DST"
34        else
35            $CMD --msgbox 'The destination must be a directory.' 7 41
36        fi
37    fi
38    unset CMD
39    unset DST
40