Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Mein erstes Shell Script zum versenden von meheren Faxen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
tuxie
Tux's lil' helper
Tux's lil' helper


Joined: 06 Jan 2003
Posts: 101

PostPosted: Sat Feb 21, 2004 9:35 am    Post subject: Mein erstes Shell Script zum versenden von meheren Faxen Reply with quote

Hallo,

ich habe ein Problemchen und benötige etwas Hilfe.

Ich habe auf meinem Home-Server eine ISDN Karte eingebaut und auch die Software und auch die Module eingerichtet. Soweitfunktioniert auch alles einwandfrei. Als nächstes habe ich mir die Software Capisuite eingreichtet.
Jetzt habe ich ausmeinem Adressbuch einen Textdatei mit ca. 30 Faxnummern exportiert (mit trennzeichen).
d.h. ich habe eine datei faxnummern.txt und einen datei Fax.ps was ich an meine Freunde versenen will. Ich möchte aber nicht jedes Fax einzeln wegschicken was ja auch möchlich wäre, da müßte ich aber

capisuitfax -d 0365436 /home/ingo/fax.ps für jede nummer eingeben.

Jetzt habe ich mir gedacht man könnte doch die Textdatei mit den FAxnummern in einem Shellscript oder Perl auslesen und jede Faxnummer das übergeben.

Jetzt weiß ich aber nicht so recht wie man die Textdatei auslesen könnte da ich sowas noch nicht gemacht habe. Hätte eventuell jemand einen Tipp für mich.

TSchau Ingo und mit besten Dank in vorraus.
Back to top
View user's profile Send private message
woormy
n00b
n00b


Joined: 23 Nov 2003
Posts: 35
Location: Ruhrgebiet

PostPosted: Sat Feb 21, 2004 10:29 am    Post subject: Re: Mein erstes Shell Script zum versenden von meheren Faxen Reply with quote

Hallo,
bin noch nicht allzulange auf linux, kenne mich mit den scripten noch nicht allzugut aus.
ich hätte da einen sehr brauchbaren link für dich :)
[url]
http://www.selflinux.org/selflinux/html/shellprogrammierung.html
[/url]
gruss woormy
Back to top
View user's profile Send private message
tuxie
Tux's lil' helper
Tux's lil' helper


Joined: 06 Jan 2003
Posts: 101

PostPosted: Sat Feb 21, 2004 11:16 am    Post subject: Reply with quote

Hallo,

danke fürden Link, aber der hilft mir nicht wirklich weiter da darin das händlen von datein nicht beschrieben wird.

TSchau Ingo
Back to top
View user's profile Send private message
ruth
Retired Dev
Retired Dev


Joined: 07 Sep 2003
Posts: 640
Location: M / AN / BY / GER

PostPosted: Sat Feb 21, 2004 11:37 am    Post subject: Reply with quote

hi,
schau mal da: vielleicht bringt dich das ja weiter...
http://www.tldp.org/LDP/abs/html/
aber:
machs doch in perl... ;-) ist ganz zufällig meine lieblings-script-sprache...
da könnte man es so in etwa machen (vorausgesetzt, deine datei ist nicht allzugross... ;-) )
Code:

---snip---
open(FILE,"< /[pfad]/[zur]/[datei]") or die "unable to open...";
@lines = <FILE>;
foreach $line (@lines) {
      # tu was gaaanz wichtiges und tolles hier...
      # du verstehst??? *grins*
}
close (FILE);
----snip----



falls du noch fragen hast....
gruss
rootshell
_________________
"The compiler has tried twice to abort and cannot do so; therefore, compilation will now terminate."
-- IBM PL/I (F) error manual
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Sat Feb 21, 2004 11:40 am    Post subject: Reply with quote

Code:

for faxnr in $(cat liste.txt); do (capisuitfax -d ${faxnr} /home/ingo/fax.ps); done

falls jeweils eine faxnr. pro zeile in liste.txt
Siehe Advanced Bash Scripting Guide,
http://www.tldp.org/LDP/abs/html/
Back to top
View user's profile Send private message
tuxie
Tux's lil' helper
Tux's lil' helper


Joined: 06 Jan 2003
Posts: 101

PostPosted: Sat Feb 21, 2004 11:42 am    Post subject: Reply with quote

Hallo, ok ich versuchs mal damit.

mein Problem ist das die Faxnummer aus der Datei an eine bestimmte stelle gestellt werden muß

capisuitfax -d <faxnummer aus datei> /pfad/zum/fax.ps

Wenn ich jetzt in perl das ausgelesen habe, dan muß ich dies ja in dieser Syntax übergeben.

Tschau Ingo
Back to top
View user's profile Send private message
tuxie
Tux's lil' helper
Tux's lil' helper


Joined: 06 Jan 2003
Posts: 101

PostPosted: Sat Feb 21, 2004 11:52 am    Post subject: Reply with quote

@Earthwings

Also er schein die List auszulesen und zu übergeben
Code:
#!/bin/sh
for faxnr in $(cat Faxnummern.txt);
do (capisuitefax -d $(faxnr) /home/samba/share/fax.ps);done



Aber irgendwie übergibt er die variable faxnr nicht richtig, capisuit bekommt immer den String faxnr übergen und nicht den inhalt der Variable.

TSchau Ingo
Back to top
View user's profile Send private message
ruth
Retired Dev
Retired Dev


Joined: 07 Sep 2003
Posts: 640
Location: M / AN / BY / GER

PostPosted: Sat Feb 21, 2004 11:55 am    Post subject: Reply with quote

hi nochmal,
hast du dich jetzt für perl oder shell entschieden?
wenn du eine faxnummerndatei mit trennzeichen hast, kommst du wahrscheinlich mit perl schneller zum ziel...
gruss
rootshell
_________________
"The compiler has tried twice to abort and cannot do so; therefore, compilation will now terminate."
-- IBM PL/I (F) error manual
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Sat Feb 21, 2004 11:57 am    Post subject: Reply with quote

$(faxnr)

da gehören geschweifte Klammern { } drum, nicht die "normalen" ( )


Last edited by Earthwings on Sat Feb 21, 2004 11:57 am; edited 1 time in total
Back to top
View user's profile Send private message
tuxie
Tux's lil' helper
Tux's lil' helper


Joined: 06 Jan 2003
Posts: 101

PostPosted: Sat Feb 21, 2004 11:57 am    Post subject: Reply with quote

Code:
#!/bin/sh
for faxnr in $(cat Faxnummern.txt);
do (capisuitefax -d $faxnr /home/samba/share/Fax.ps);done
~

So funktioniert es

Tschau Ingo und Danke
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum