File: no-compound_marking

package info (click to toggle)
dsdo 1.6.25-1.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,568 kB
  • sloc: makefile: 168; perl: 40; sh: 17
file content (30 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /bin/bash
#-----------------------------------------------------------------------------
#--  No-compound list:

if [ ! -e "$1" ]; then
   touch "$1"
fi

#-----------------------------------------------------------------------------
#--  Scan input:

while read line; do
   word=$(  echo "${line}" | cut -d/ -f1 )

   if [ "$( echo "${line}" | tr -cd '/' )" = "/" ]; then
      flags=$( echo "${line}" | cut -d/ -f2 | sed 's/m//g' )
   else
      flags=
   fi

   grep -q '^'"${word}"'$' "$1" 1>/dev/null || flags="${flags}m"

   if [ -z "${flags}" ]; then
      echo "${word}"
   else
      echo "${word}/${flags}"
   fi
done

#-----------------------------------------------------------------------------