Linked Questions

2
votes
0answers
55 views

doesn't work the bash script to check given single character is in lower case or uppercase [duplicate]

I write below shell script to check whether given character is in uppercase or lowercase.. read d case $d in [a-z]) echo "Character is in Lowercase";; [A-Z]) echo "Character is in Uppercase";; esac ...
14
votes
5answers
3k views

Case sensitivity in square-bracket globbing

Normally, bash globbing is case sensitive: $ echo c* casefix.pike cdless chalices.py charconv.py chocolate.pike circum.py clip.pike cpustats.pike crop.pike cwk2txt.py $ echo C* CarePackage.md ...
28
votes
2answers
12k views

Does (should) LC_COLLATE affect character ranges?

Collation order through LC_COLLATE defines not only the sort order of individual characters, but also the meaning of character ranges. Or does it? Consider the following snippet: unset LANGUAGE ...
5
votes
3answers
920 views

Why should 'Character Classes' be preferred over 'Character Ranges' In Shell (Bash)?

The Linux Command Line (Book - page count 47) says: ... you have to be very careful with them [character ranges] because they will not produce the expected results unless properly configured. For ...
0
votes
3answers
615 views

how to check if FQDN host-name is with only small letters

we want to check the hostname on machines the rule should be like this: each hostname must be only with small letters each hostname is FQDN we try this hostname=master01.nassa.com [[ $hostname =~ ^...
3
votes
1answer
1k views

Double square parenthese inside grep pattern

grep "^[[:space:]]*clientPort[^[:alpha:]]" zoo.cfg This is a grep pattern to extract the line that contains the port number from the configuration file. 1) Normally in a regex, I use square brackets ...
0
votes
2answers
2k views

In shell script case statement unable to recognize upper case letters

I have the following shell script #! /bin/bash echo -e "Enter any character: \c" read value case $value in [a-z] ) echo You have entered a lower case alphabet;; [A-Z] ) echo ...
2
votes
2answers
490 views

sed: how to insert a newline into a regular expression?

I'm trying to format a text file. Right now it generally looks like this: s ApartCD Compact DiscCD-ROM Compact Disc-Read-Only MemoryCD-RW Compact Disc-RewritableCDFS Compact Disc File SystemCERT ...
0
votes
1answer
291 views

Wildcards/Globbing: Are character ranges problematic?

In The Linux Command Line William Shotts claims that character ranges can be problematic. See the relevant excerpt below, emphasis is mine. Character Ranges If you are coming from another Unix-like ...
3
votes
2answers
146 views

alphabetical expansion order for *

When I'm using a POSIX compliant shell (es: dash, bash, zsh, ...) can I be sure that * will always expand in alphabetical order (dictated by LC_COLLATE)? example: $ echo 1 > file_a $ echo 2 > ...
1
vote
1answer
88 views

How do Bash and Zsh handle collation in patterns and regexes?

Consider the following example: $ bash --version GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &...