Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
agetic
librecast
Commits
c96f05ec
Commit
c96f05ec
authored
Sep 05, 2017
by
Carlos Remuzzi
Browse files
implementando parser de argumentos
parent
7f2dc675
Changes
1
Hide whitespace changes
Inline
Side-by-side
librecast
View file @
c96f05ec
#!/usr/bin/env bash
AP_ADDRESS
=
192.168.12.1
# legacy, porque hemos empezado con la sala llamada libreCast-s1
if
[
$#
-eq
1
]
;
then
AP_ADDRESS
=
$1
fi
if
[
$#
-eq
2
]
;
then
AP_NAME
=
$2
fi
valid_ip
()
{
local
ip
=
$1
local stat
=
1
if
[[
$ip
=
~ ^[0-9]
{
1,3
}
\.
[
0-9]
{
1,3
}
\.
[
0-9]
{
1,3
}
\.
[
0-9]
{
1,3
}
$
]]
;
then
OIFS
=
$IFS
IFS
=
'.'
ip
=(
$ip
)
IFS
=
$OIFS
[[
${
ip
[0]
}
-le
255
&&
${
ip
[1]
}
-le
255
\
&&
${
ip
[2]
}
-le
255
&&
${
ip
[3]
}
-le
255
]]
stat
=
$?
fi
return
$stat
}
invocar_nmcli
()
{
echo
"conectando a
$AP_NAME
"
...
...
@@ -89,4 +95,20 @@ main() {
fi
}
# por defecto apuntamos a la ip predefinida del AP wifi
AP_ADDRESS
=
192.168.12.1
if
[
$#
-eq
1
]
;
then
if
valid_ip
$1
;
then
AP_ADDRESS
=
$1
else
AP_NAME
=
$1
fi
fi
if
[
$#
-eq
2
]
;
then
AP_ADDRESS
=
$1
AP_NAME
=
$2
fi
main
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment