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