The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remove directory that has special Characters datherriault UNIX for Dummies Questions & Answers 12 01-14-2009 05:53 PM
remove special and unicode characters shantanuo UNIX for Dummies Questions & Answers 1 12-05-2008 09:16 AM
Remove lasts characters from a string chriss_58 Shell Programming and Scripting 6 11-28-2008 06:07 AM
Help with find and replace w/string containing special characters CAGIRL UNIX for Dummies Questions & Answers 4 10-07-2008 07:13 PM
Add string after another string with special characters heliode Shell Programming and Scripting 2 03-21-2008 08:06 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 12-04-2008
chebarbudo's Avatar
chebarbudo chebarbudo is offline
Registered User
  
 

Join Date: Nov 2008
Location: various
Posts: 188
Quote:
Originally Posted by radoulov View Post
And what's wrong with Franklin52's solution?
Absolutely nothing, I was working on it while you posted this solution.
It looks great exept that as a newbie, I don't fully understand the syntax
Quote:
Originally Posted by radoulov View Post
Code:
$ cat s
#! /bin/bash
tr 2>&- -d "$2"<<<"$1"
What is <<<? Is this a way of doing echo?
I understand the tr -d but what does 2>&- means?
redirect errors to &-? What is &-?
Thanks for your help.
Santiago
  #9 (permalink)  
Old 12-04-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,794
Quote:
Originally Posted by chebarbudo View Post
[...]
What is <<<? Is this a way of doing echo?
Here string. It's not available in all shells.
For more information search your shell manpages for Here Strings.

Quote:
I understand the tr -d but what does 2>&- means?
redirect errors to &-? What is &-?
2>&- closes the file descriptor 2. This is a bad practice and you should avoid it. My post was for illustration purposes only.
  #10 (permalink)  
Old 05-22-2009
KiranKumarKarre KiranKumarKarre is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 62
Hi

I have the following string which contains -> symbol, i need to split this string into two strings using shell script in unix. can anyone help me out.

test_inbox123_link.txt->/home/pbommire/Praveen/kiran/inbox/test_inbox.txt

r
  #11 (permalink)  
Old 07-04-2009
chebarbudo's Avatar
chebarbudo chebarbudo is offline
Registered User
  
 

Join Date: Nov 2008
Location: various
Posts: 188
Hi KiranKumarKarre,

Code:
localhost:~# string='test_inbox123_link.txt->/home/pbommire/Praveen/kiran/inbox/test_inbox.txt'
localhost:~# echo ${string%->*}
test_inbox123_link.txt
localhost:~# echo ${string#*->}
/home/pbommire/Praveen/kiran/inbox/test_inbox.txt
  #12 (permalink)  
Old 07-05-2009
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,047
Code:
echo "My name's Santiago. What's yours?" | tr -d "atu"
Sponsored Links
Reply

Bookmarks

Tags
shell script, shell scripting, str, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0