The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

As everyone else sleeps, KS sits up waiting... by Kickstart 2006-06-17 10:03:00
and wanting to fix the diary post.

Does someone have a solution for this?

The following grabs a bunch of comments from the db, and creates an array in Bash:

grab=( `/usr/local/bin/mysql uf -s -e "select DIARYCOMMENTS.ITEM,DIARYCOMMENTS.ID,DIARYCOMMENTS.USERNAME,USERS.USERN
AME from DIARYCOMMENTS,USERS where USERS.ID=ITEM ORDER BY TIMESTAMP DESC LIMIT 10"` )

Unfortunately, because the array elements are separated by spaces, any spaces in USERNAME cause the script to break. How can I alter this line so that usernames with spaces are accepted as a single element of the array, whole?

If we can solve this today, I'll increase the number of diaries listed to 30.

Thx,

KS
[ Reply ]
  You could try... by RojSmith2006-06-17 10:08:05
    Nope...I just get... by Kickstart2006-06-17 10:25:46
      replacing USERS.USERNAME with... by kahuana2006-06-17 10:27:14
        Ooo, hrm. by Kickstart2006-11-19 12:55:59
          Solved. by Sharku2006-06-17 11:01:26
            Nope, not helping :( (n/t) by Kickstart2006-06-17 12:00:50
          I tried it in using my aquarium** and it didn't wo by kahuana2006-06-17 11:45:07
        *facepalm* I should'a read the select *twice*. by kahuana2006-06-17 10:38:35
          yeah, did so (n/t) by Kickstart2006-06-17 10:39:15
        Bash quoting uses single quotes by Didactylos2006-06-17 12:17:19
  My thought would be... by imperito2006-06-17 10:33:21
    I agree, but... by Kickstart2006-06-17 10:38:36
  Try changing your IFS variable in bash? (n/t) by SnArL2006-06-17 10:43:30
    That looks like it works best. by kahuana2006-06-17 11:38:31
      Bleargh. by Didactylos2006-06-17 12:19:10
        Here's what I ended up doing... by Kickstart2006-06-17 12:23:56
          Use & nbsp; for display? (n/t) by Didactylos2006-06-17 12:26:35
            Maybe so.. by Kickstart2006-06-17 12:30:46
              Select it twice, by Didactylos2006-06-17 12:34:53
                <Deleted><Deleted>2006-06-17 15:37:22
                  `echo ${grab[n]} | sed 's/%20/&nbsp;/'` by ToLazyToThink2006-06-17 12:59:13
                    Ah, but... by Kickstart2006-06-17 13:02:25
                      The repeated expression might be replaced with... by kahuana2006-06-17 13:18:59
                        ooo, that's nice (n/t) by Kickstart2006-06-17 13:48:54
                      You niticed the back ticks right? by ToLazyToThink2006-06-17 15:21:36
                        All sh-compatible shells do that... (n/t) by bwkaz2006-06-17 16:55:29
                  Mods, this breaks the board for me (n/t) by ToLazyToThink2006-06-17 15:22:46
                  Moderated for breaking the horizontal scroll (n/t) by Nea2006-06-17 15:37:43
                    Doh, thanks (n/t) by Kickstart2006-06-17 15:50:41

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)