loksh | A Linux port of OpenBSD 's ksh
kandi X-RAY | loksh Summary
kandi X-RAY | loksh Summary
loksh is a Linux port of OpenBSD's ksh. Unlike other ports of ksh, loksh targets only one platform, follows upstream closely and keeps changes to a minimum. loksh does not add any extra features; this reduces the risk of introducing security vulnerabilities and makes loksh a good fit for resource-constrained systems.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of loksh
loksh Key Features
loksh Examples and Code Snippets
Community Discussions
Trending Discussions on loksh
QUESTION
I ran the following command (*sh
being the name of a sh
implementation) with all the shells I could find; although I was expecting all to print match
, I got inconsistent results. I don't know which behavior is correct and reliable.
ANSWER
Answered 2019-Dec-16 at 13:43Perhaps this bit of reference can clear things up for your question. From the POSIX's Shell Command Language specification - under Pattern Matching Notation the clause states,
2.13.1 Patterns Matching a Single Character
A
character shall escape the following character. The escaping
shall be discarded. If a pattern ends with an unescaped
, it is unspecified whether the pattern does not match anything or the pattern is treated as invalid
The above rule applies to patterns while using the case
statements and when using the the ==
glob match operator in bash
using test
construct.
So since your $2
remains unquoted while undergoing pattern match, the literal value of f\\oo
is lost forever and gets interpreted as f\oo
.
Just to clear things up, the shell has preserved your literal value during quote removal and just when applying the passed argument in this pattern matching rule, this behavior is exhibited.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install loksh
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page