0

I'm in a very similar situation to this: PDF viewer/reader that supports cycling through documents

The only answer suggest to create a bash script that opens all files, one after the other after killing the previous with a keyboard shortcut. This seems to by a very nice solution but the bash script doesnt work. Given my very limited experience with bash, could you find the problem here and explain me how to do such a script that actually works? Thanks in advance!

grep=$(which grep)
files=( *."pdf" )
count=$(printf '%d\n' "${#files[@]}")
no=0
skip=${1:-0}

for i in "${files[@]}"; do
  ((no++))
  if [ $skip -gt $no ]; then
    continue
  fi

  echo $no of $count - $(($no*100/$count)) '%'
  echo -n "Note for file"'['$i']:'

  evince "$i" # -i 3 opens the third page
  # use a shortcut to kill evince here
  clear

  echo $no of $count - $(($no*100/$count)) '%'
  echo -n "Note for file"'['$i']:'
  read ok

  echo $no > .batchview-status
  [ -n "$ok" ] && echo "$i" >> notes.txt
  [ -n "$ok" ] && echo "$ok" >> notes.txt
done
  • Without knowing what problems you are having, it is difficult to recommend solutions. Please post any errors you are getting and/or expand on "doesn't work". Looking at the script you posted, it will require `bash` and would not run in `sh` and it requires the `evince` document viewer to be installed and available in `$PATH`. – GracefulRestart Feb 07 '20 at 00:54
  • sorry, the error it gives is: `open_eps.sh: 2: open_eps.sh: Syntax error: "(" unexpected` where open_eps.sh is the name of the bash script – faeriewhisper Feb 07 '20 at 01:00
  • oh! it runs on `bash` :) sorry, im really a newbie... – faeriewhisper Feb 07 '20 at 01:04

0 Answers0