LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-28-2016, 03:45 PM   #16
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,508

Rep: Reputation: 1811Reputation: 1811Reputation: 1811Reputation: 1811Reputation: 1811Reputation: 1811Reputation: 1811Reputation: 1811Reputation: 1811Reputation: 1811Reputation: 1811

Quote:
Originally Posted by Kytsuine View Post
Okay, I replaced the while loop with what you had in the newest one, and ended up with a .tiff named {a...z}{a...z}.tiff, which caused me some confusion.
Did you put three 3 dots instead of 2 in the loop header?
 
1 members found this post helpful.
Old 04-28-2016, 03:56 PM   #17
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,028

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
Good catch...
 
Old 04-28-2016, 03:57 PM   #18
Kytsuine
LQ Newbie
 
Registered: Sep 2015
Location: Western Kentucky. No, farther west. Farther... there you go.
Distribution: Linux Mint 17.2 Cinnamon, Kali Linux, Arch (still debugging USB install...)
Posts: 25

Original Poster
Rep: Reputation: Disabled
I just realized why copy and paste is a beautiful tool. There are two dots between a and z. I'll adjust that and retry tomorrow once I get back to the workstation. Although, reading through another thread, would the following work to increment the file names for up to 260 pages (which I should never need)?
Code:
 
$x=0
$i=1
for y in {A..Z}
if $x=10
then $x=1
else
echo Scanning page $i
scanimage > $y$x yada yada
$x=(( $x + 1 ))
$i=(( $i + 1 ))
end
done
Sorry for the lack of good formatting and the like, I'm on mobile and this keyboard is anything but programming-friendly.

Last edited by Kytsuine; 04-28-2016 at 03:59 PM.
 
Old 04-28-2016, 04:08 PM   #19
Kytsuine
LQ Newbie
 
Registered: Sep 2015
Location: Western Kentucky. No, farther west. Farther... there you go.
Distribution: Linux Mint 17.2 Cinnamon, Kali Linux, Arch (still debugging USB install...)
Posts: 25

Original Poster
Rep: Reputation: Disabled
Oh, hey, y'all found it faster than I did. So it gives a two-letter name? Disregard my question, then, apart from any academic interest.
 
Old 04-28-2016, 04:08 PM   #20
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,028

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
Its missing a few statements. As stated previously the {A..Z}{A..Z} should generate a sequence as AA,AB,AC..AZ,BA,BC..BZ and so on which is 26*26 or 676 possible names or in your case pages and if it works simpler.
 
Old 04-28-2016, 05:01 PM   #21
Kytsuine
LQ Newbie
 
Registered: Sep 2015
Location: Western Kentucky. No, farther west. Farther... there you go.
Distribution: Linux Mint 17.2 Cinnamon, Kali Linux, Arch (still debugging USB install...)
Posts: 25

Original Poster
Rep: Reputation: Disabled
Solved?

I checked the file, and I made a typo in transcription, it was correct in the file. It's not really important, though, as I replaced it with the whole sequence of letters between AA and ZZ (Thanks, Google!), which worked fine. I checked Kali's Bash version, which echoes as 4.something, and I know that support for {a..z} syntax started with release 3, so I'm not sure why it didn't work. Whatever the case, I tested the workaround on my home scanner and it works beautifully. Thank you so much! I'll wait until it executes successfully on the actual workstation before calling it solved, but I think it will be. Here's the final code.
Code:
#!/bin/bash

echo "Type the name you want for the finished file"
read doc
echo "How many pages are in the file?"
read pgs

x=1
for y in AA AB AC AD AE AF AG AH AI AJ AK AL AM AN AO AP AQ AR AS AT AU AV AW AX AY AZ BA BB BC BD BE BF BG BH BI BJ BK BL BM BN BO BP BQ BR BS BT BU BV BW BX BY BZ CA CB CC CD CE CF CG CH CI CJ CK CL CM CN CO CP CQ CR CS CT CU CV CW CX CY CZ DA DB DC DD DE DF DG DH DI DJ DK DL DM DN DO DP DQ DR DS DT DU DV DW DX DY DZ EA EB EC ED EE EF EG EH EI EJ EK EL EM EN EO EP EQ ER ES ET EU EV EW EX EY EZ FA FB FC FD FE FF FG FH FI FJ FK FL FM FN FO FP FQ FR FS FT FU FV FW FX FY FZ GA GB GC GD GE GF GG GH GI GJ GK GL GM GN GO GP GQ GR GS GT GU GV GW GX GY GZ HA HB HC HD HE HF HG HH HI HJ HK HL HM HN HO HP HQ HR HS HT HU HV HW HX HY HZ IA IB IC ID IE IF IG IH II IJ IK IL IM IN IO IP IQ IR IS IT IU IV IW IX IY IZ JA JB JC JD JE JF JG JH JI JJ JK JL JM JN JO JP JQ JR JS JT JU JV JW JX JY JZ KA KB KC KD KE KF KG KH KI KJ KK KL KM KN KO KP KQ KR KS KT KU KV KW KX KY KZ LA LB LC LD LE LF LG LH LI LJ LK LL LM LN LO LP LQ LR LS LT LU LV LW LX LY LZ MA MB MC MD ME MF MG MH MI MJ MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NB NC ND NE NF NG NH NI NJ NK NL NM NN NO NP NQ NR NS NT NU NV NW NX NY NZ OA OB OC OD OE OF OG OH OI OJ OK OL OM ON OO OP OQ OR OS OT OU OV OW OX OY OZ PA PB PC PD PE PF PG PH PI PJ PK PL PM PN PO PP PQ PR PS PT PU PV PW PX PY PZ QA QB QC QD QE QF QG QH QI QJ QK QL QM QN QO QP QQ QR QS QT QU QV QW QX QY QZ RA RB RC RD RE RF RG RH RI RJ RK RL RM RN RO RP RQ RR RS RT RU RV RW RX RY RZ SA SB SC SD SE SF SG SH SI SJ SK SL SM SN SO SP SQ SR SS ST SU SV SW SX SY SZ TA TB TC TD TE TF TG TH TI TJ TK TL TM TN TO TP TQ TR TS TT TU TV TW TX TY TZ UA UB UC UD UE UF UG UH UI UJ UK UL UM UN UO UP UQ UR US UT UU UV UW UX UY UZ VA VB VC VD VE VF VG VH VI VJ VK VL VM VN VO VP VQ VR VS VT VU VV VW VX VY VZ WA WB WC WD WE WF WG WH WI WJ WK WL WM WN WO WP WQ WR WS WT WU WV WW WX WY WZ XA XB XC XD XE XF XG XH XI XJ XK XL XM XN XO XP XQ XR XS XT XU XV XW XX XY XZ YA YB YC YD YE YF YG YH YI YJ YK YL YM YN YO YP YQ YR YS YT YU YV YW YX YY YZ ZA ZB ZC ZD ZE ZF ZG ZH ZI ZJ ZK ZL ZM ZN ZO ZP ZQ ZR ZS ZT ZU ZV ZW ZX ZY ZZ
do
   echo "Press enter key to scan page $x"
   read answer
   echo Scanning $doc-$x
   scanimage > $y.tiff --format=tiff --mode=Gray --resolution 200dpi
   x=$(( $x + 1 ))
   if [ $x -gt $pgs ]
   then
     break
   fi
done
echo "Converting now"
convert *.tiff 1.pdf
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=$doc.pdf 1.pdf
rm *.tiff 1.pdf
I even understand all of it except the fi. Again, thank you very much for your help; you've been an absolute blessing.
-Kytsuine
 
Old 04-28-2016, 05:06 PM   #22
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,028

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
fi is if backwards. It indicates the end of the statements that are executed within the if conditional.
 
1 members found this post helpful.
Old 04-28-2016, 05:14 PM   #23
Kytsuine
LQ Newbie
 
Registered: Sep 2015
Location: Western Kentucky. No, farther west. Farther... there you go.
Distribution: Linux Mint 17.2 Cinnamon, Kali Linux, Arch (still debugging USB install...)
Posts: 25

Original Poster
Rep: Reputation: Disabled
I would never have thought of that, but it makes perfect sense.
 
Old 04-29-2016, 12:59 PM   #24
Kytsuine
LQ Newbie
 
Registered: Sep 2015
Location: Western Kentucky. No, farther west. Farther... there you go.
Distribution: Linux Mint 17.2 Cinnamon, Kali Linux, Arch (still debugging USB install...)
Posts: 25

Original Poster
Rep: Reputation: Disabled
It works here, too! Thanks again, and God bless! I'll mark the thread as solved as soon as I figure out how to from the app.
 
  


Reply

Tags
bash, ghostscript, scanning, terminal


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] scanning makes page huge mark_alfred Linux - Software 16 12-12-2014 09:29 PM
Web page automation - application Gr2600 Programming 6 01-06-2013 12:37 PM
Extracting 1 page from a PDF Document dazdaz General 2 06-16-2012 09:51 AM
Bluetooth, synching, treo750, document scanning, sd card reader, vaio laptop, kubuntu Josef Lauei Linux - Newbie 1 09-30-2008 08:32 AM
Document Automation in Linux??? JaseP Linux - Software 7 04-07-2004 12:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration