Unix bash shell scripting permissions -


i supposed use r, w, h, k keys in script. h moving cursor left, k moving cursor above line. r changing permissions of group, user or others depending on cursor position. , same w key. able h , k keys, r key, having problem getting current position , applying chmod r , w keys. below code:

stty -icanon min 1 time 0 -echo command=$(dd bs=3 count=1 2> /dev/null) case $command in    q) rm /tmp/temp.$$      stty icanon echo      tput cup $myline 0      exit 0 ;;    h) if [ $index != 0 ]              tput cub 999        currpos=$(( index - 1 ))        tput cuf ${positions[$currpos]}        index=$(( index - 1 ))      fi ;;    l) if [ $index != 9 ]             tput cub 999        currpos=$(( index + 1 ))        tput cuf ${positions[$currpos]}        index=$(( index + 1 ))      fi ;;   r) if [ $index != 0 ]             tput cub 999        currpos=$((index -1 ))      fi ;;    k) if [ $currentline != 1 ]             tput cud 1        tput cub 99        tput el        echo ""        tput cuu 3        tput cuf 26        if [ $onfile = false ]                 cd ..        fi        links=$(ls -ld . | awk '{print $2}')        owner=$(ls -ld . | awk '{print $3}')        group=$(ls -ld . | awk '{print $4}')        size=$(ls -ld . | awk '{print $5}')        date=$(ls -ld . | awk '{print $6,$7,$8}')        tput cub 99         echo "  links: $links  owner: $owner  group: $group  size: $size  modified: $date"        tput cuu 2        tput cub 999        tput cuf ${positions[$index]}         onfile=false        currentline=$(( currentline - 1 ))      fi ;; 


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -