•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 402,521 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,676 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 444 | Replies: 2
![]() |
With ksh93, bash, zsh:
For old shells use case:
[[ $VAR == L* ]]&&echo OK||echo KO
For old shells use case:
case $VAR in L*) echo OK;;*)echo KO;;esac
•
•
Join Date: Oct 2007
Posts: 267
Reputation:
Rep Power: 1
Solved Threads: 26
Hey there,
If you need to be more generic (like sometimes you want to match the first 3 letters and sometimes 2, etc) you can use expr's : (colon) operator to do string and substring matching.
Hope that helps,
Mike
If you need to be more generic (like sometimes you want to match the first 3 letters and sometimes 2, etc) you can use expr's : (colon) operator to do string and substring matching.
Hope that helps,
Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Check the state of a check box from a different form (VB.NET)
- Application Variable (VB.NET)
- MYSQL/PHP variable check (MySQL)
- Accessing a variable of another class (Java)
- How Can I Pass A PHP Variable From One .php page to another (PHP)
- State abbreviations (C++)
- Adding a checkbox column dynamically (C#)
- Please check and provide solution for my code (ASP)
Other Threads in the Shell Scripting Forum
- Previous Thread: writing a script for nagios checks...
- Next Thread: HTTP server in bash


Linear Mode