HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: String & shell
Operating System - Linux
1828658
Members
1303
Online
109983
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 09:28 PM
04-06-2006 09:28 PM
String & shell
Hello,
I try to play whith string in shell.
Exemple :
I want to convert the string "toto" in "tot[o]".
I don't want to use awk, sed, expr.... and i want it works with sh, bash and ksh.
So I have echo "v=echo ${var%?}" and "echo ${var##$v}" to split it. Then i just concat it...
But this works with bash and ksh but not with sh !
Is there someone who have an idea to make it ?!?
Thank's
I try to play whith string in shell.
Exemple :
I want to convert the string "toto" in "tot[o]".
I don't want to use awk, sed, expr.... and i want it works with sh, bash and ksh.
So I have echo "v=echo ${var%?}" and "echo ${var##$v}" to split it. Then i just concat it...
But this works with bash and ksh but not with sh !
Is there someone who have an idea to make it ?!?
Thank's
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 09:57 PM
04-06-2006 09:57 PM
Re: String & shell
When you say 'sh', which shell do you actually mean?
On most Linux systems, 'sh' will be a symbolic link to 'bash'.
If you're talking HP-UX's 'bourne' shell, then no, these won't work at all.
As far as I'm aware, there isn't that level of string manipulation with the bourne shell. You have to use either awk/sed/expr to get that sort of result.
On most Linux systems, 'sh' will be a symbolic link to 'bash'.
If you're talking HP-UX's 'bourne' shell, then no, these won't work at all.
As far as I'm aware, there isn't that level of string manipulation with the bourne shell. You have to use either awk/sed/expr to get that sort of result.
One long-haired git at your service...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 11:32 PM
04-06-2006 11:32 PM
Re: String & shell
In fact, i want to test a file existence. But it could be a symbolic link, a directory or other ... and it could be automounted !
with "echo /ect/passw[d]", for exemple, i can test it without be mounted. And "test -f" or other mount it...
If you have any idea.
Thank's
with "echo /ect/passw[d]", for exemple, i can test it without be mounted. And "test -f" or other mount it...
If you have any idea.
Thank's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2006 02:53 AM
04-07-2006 02:53 AM
Re: String & shell
I find a solution.
tmp=`echo $toto*`
set $tmp
res=`echo $1`
and i just compare $res and $toto to know if it's good...
CedBer
tmp=`echo $toto*`
set $tmp
res=`echo $1`
and i just compare $res and $toto to know if it's good...
CedBer
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP