You are not logged in.

#1 2009-01-24 19:23:18

xuehuichao
Member
Registered: 2008-01-15
Posts: 11

In rc.conf, how to specify a parameter with a white space in it?

I'm setting up the wireless network. In rc.conf:

wlan_wlan0="wlan0 essid myessid key mykey"

myessid in my case is something like "ABC DE", I've tried many ways, but it seems all archlinux is doing is to simply split that string with white space characters as deliminaters.

Can any one tell me how to write the correct script in my case? Thank you.

Offline

#2 2009-01-24 19:45:02

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: In rc.conf, how to specify a parameter with a white space in it?

Something like "ABC\ DE" should work.

Offline

#3 2009-01-24 19:48:10

xuehuichao
Member
Registered: 2008-01-15
Posts: 11

Re: In rc.conf, how to specify a parameter with a white space in it?

Unfortunately no... It is not working.

I tried:

wlan_wlan0="wlan0 essid ABC\ DE key mykey"
wlan_wlan0='wlan0 essid "ABC DE" key mykey'
wlan_wlan0="wlan0 essid ABC\\ DE key mykey"
wlan_wlan0='wlan0 essid ABC\ DE key mykey'

they won't work...

Offline

#4 2009-01-24 20:18:08

Sander Hoksbergen
Member
Registered: 2009-01-06
Posts: 32

Re: In rc.conf, how to specify a parameter with a white space in it?

wlan_wlan0="wlan0 essid \"ABC DE\" key mykey"

That should work...I think...

Offline

#5 2009-01-24 20:23:59

xuehuichao
Member
Registered: 2008-01-15
Posts: 11

Re: In rc.conf, how to specify a parameter with a white space in it?

I reconfigured the router, and changed my essid....

I think the system is splitting the string and passing the parameters to iwconfig. If that is the case, it may not support white space, I think...

Thank you all for your reply smile

Offline

#6 2009-01-25 00:20:08

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: In rc.conf, how to specify a parameter with a white space in it?

Worst case, I would file a bug report, as there should be a way to do this smile

Offline

#7 2009-01-25 00:28:28

sisco311
Member
From: Romania
Registered: 2008-05-23
Posts: 112

Re: In rc.conf, how to specify a parameter with a white space in it?

Ranguvar wrote:

Worst case, I would file a bug report, as there should be a way to do this smile

+1
i would try foo\040bar


don't drink unwashed fruit juice.
i never make predictions, especially about the future.

Offline

#8 2010-07-08 20:08:33

brendan
Member
From: UK
Registered: 2009-05-16
Posts: 130
Website

Re: In rc.conf, how to specify a parameter with a white space in it?

sisco311 wrote:
Ranguvar wrote:

Worst case, I would file a bug report, as there should be a way to do this smile

+1
i would try foo\040bar

This doesn't work either. Anyone got any ideas before I file a bug report?

Offline

#9 2010-07-09 19:22:09

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

Re: In rc.conf, how to specify a parameter with a white space in it?

wlan_wlan0="wlan0 essid 'ABC\\ DE' key mykey"

This is the one variant you seem to not have tried. IIRC when using quotes, you need to use one set of quotes and a different set inside of the first quote marks.  Of course I could be wrong but give it a try and see?

Offline

#10 2010-07-09 21:24:29

diegonc
Member
Registered: 2008-12-13
Posts: 42

Re: In rc.conf, how to specify a parameter with a white space in it?

I think this is not possible.

/etc/rc.d/network

wi_up()
{   
  eval iwcfg="\$wlan_${1}"
  [ "$iwcfg" = "" ] && return 0
  
  /usr/sbin/iwconfig $iwcfg

iwcfg is used unquoted and thus subject to field splitting. The standard doesn't seem to provide any way to switch it off from inside the string being splitted.

Last edited by diegonc (2010-07-09 21:25:16)

Offline

#11 2010-07-09 23:54:00

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: In rc.conf, how to specify a parameter with a white space in it?

@diegonc - good find.

@OP - looks like you should file a bug report


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB