[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
getopts strange behaviour (Fedora)
From: |
cs |
Subject: |
getopts strange behaviour (Fedora) |
Date: |
Tue, 28 Jun 2005 12:06:38 +0300 (EEST) |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-D_FILE_OFFSET_BITS=64 -O2 -g -pipe -march=i386 -mcpu=i686
uname output: Linux FC1-zalmoxe 2.4.30 #1 SMP Tue May 3 15:29:16 EEST 2005 i686
i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
getopts builtin command problem when parameters lack
Repeat-By:
While trying to use getopts builtin bash command I encountered the
following problem:
Test script:
#!/bin/sh (/bin/bash)
getopts ":xy" X
echo $X
The output for this script , ran without parameters is :
Fedora Core 1
[root@fc1 root]# sh script
a
[root@fc1 root]# sh script -t
a
[root@fc1 root]# sh script -x
x
[root@fc1 root]#
Fedora Core 2
[root@fc2 root]# sh script
a f
[root@fc1 root]# sh script -t
a f
[root@fc1 root]# sh script -x
x
[root@fc1 root]#
According to the man page it should return `?' (question mark).
Tests were also performed on Debian and Slackware distributions
and the results were as expected. (OK)
If there is something that I should've known, please let me know.
Chris.
- getopts strange behaviour (Fedora),
cs <=