+ Post New Thread
Results 1 to 7 of 7
Scripts Thread, Help needed writing a pkinvoice script in Coding and Web Development; OK... the wonderful PyKota box is running pretty smoothly now and I'm looking ahead to charging the departments. To do ...
  1. #1

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,593
    Thank Post
    109
    Thanked 764 Times in 595 Posts
    Rep Power
    181

    Help needed writing a pkinvoice script

    OK... the wonderful PyKota box is running pretty smoothly now and I'm looking ahead to charging the departments. To do this, I thought that I would use pkinvoice to generate invoices for each staff user.

    The staff users can be distinguished by the first character of the username being a letter rather than a number.

    My idea was to export the users to a file which I could then read a line at a time and run the pkinvoice command for the username on each line. My problem is that I'm unsure how to read files in a bash script ops:

  2. #2

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Help needed writing a pkinvoice script

    http://tldp.org/LDP/abs/html/index.html

    Part 5 Section 19 and Appendix E seem relevant.

  3. #3

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,593
    Thank Post
    109
    Thanked 764 Times in 595 Posts
    Rep Power
    181

    Re: Help needed writing a pkinvoice script

    @Geoff: That is where I have been looking... I cannot seem to figure out a way of reading one line at a time though.

  4. #4

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Help needed writing a pkinvoice script

    It's a stream.

  5. #5

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,593
    Thank Post
    109
    Thanked 764 Times in 595 Posts
    Rep Power
    181

    Re: Help needed writing a pkinvoice script

    @Geoff: Enlighten me to the syntax that I desire then

  6. #6

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,756
    Thank Post
    3,265
    Thanked 1,052 Times in 973 Posts
    Rep Power
    365

    Re: Help needed writing a pkinvoice script

    use a loop and in the do sectoin just get it to read the one line at a time and then go to the next line after reading it and make it do it until the end of the file

    http://tldp.org/LDP/abs/html/loops1.html

  7. #7

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Help needed writing a pkinvoice script

    I'm going to cheat and use awk (disclaimer: untested)..

    Code:
    cat userlist | awk {print $0 | pkinvoice}

SHARE:
+ Post New Thread

Similar Threads

  1. *nix Script needed for backup job
    By ICTNUT in forum *nix
    Replies: 2
    Last Post: 14th November 2007, 09:59 AM
  2. Writing the School website
    By witch in forum General Chat
    Replies: 13
    Last Post: 27th March 2006, 10:49 PM
  3. Replies: 4
    Last Post: 23rd March 2006, 06:27 AM
  4. Who is responsible for writing ICT policies
    By richard in forum School ICT Policies
    Replies: 6
    Last Post: 14th March 2006, 06:37 PM
  5. Replies: 12
    Last Post: 12th September 2005, 10:47 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •