LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-16-2017, 02:13 PM   #1
Merh
LQ Newbie
 
Registered: Feb 2017
Posts: 15

Rep: Reputation: Disabled
Smile What shall I do to remove the strange charachter â in the begining and the end ? Bash shell script please help


lsof /mypath/paths* >> x.x
while IFS= read -r p;
do
dest="$p"
f="${dest#*/}"
echo "$f"
if test `find "$f" -mmin +60`
then
echo "$f"
fi
done <x.x


find: âoperat/32385â: No such file or directory
but it must be operat/32385.
When I echo before the command find, everything is ok. What shall I do to remove the strange charachter â in the begining and the end ?
Thanks in advance
Merh
 
Old 05-16-2017, 02:42 PM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Please explain what is your goal, what this script is supposed to?
Edit: also read this: http://www.linuxquestions.org/questi...0/#post5707388

Last edited by NevemTeve; 05-16-2017 at 02:50 PM.
 
Old 05-16-2017, 02:59 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Merh View Post
find: âoperat/32385â: No such file or directory
but it must be operat/32385.
this has nothing to do with why your script fails; it's just find's error message and i'm guessing it's putting the filename in curly “quotes”, and your terminal is using a font that cannot display that, or doesn't use UTF-8.
in other words, it's harmless.
that said, my find does not do that.
what version of find (and what linux distro) are you using?

Code:
$> find --version
find (GNU findutils) 4.6.0

Last edited by ondoho; 05-16-2017 at 03:00 PM.
 
Old 05-16-2017, 03:17 PM   #4
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by ondoho View Post
this has nothing to do with why your script fails; it's just find's error message and i'm guessing it's putting the filename in curly “quotes”, and your terminal is using a font that cannot display that, or doesn't use UTF-8.
in other words, it's harmless.
that said, my find does not do that.
what version of find (and what linux distro) are you using?

Code:
$> find --version
find (GNU findutils) 4.6.0
For info, my version of find (Linux Mint 18.1; find (GNU findutils) 4.7.0-git) places E2 80 98 (U+2018; left single quotation mark) before the filepath in the error and E2 80 99 (U+2019; right single quotation mark) after.
 
Old 05-16-2017, 04:51 PM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by Merh View Post
Code:
if test `find "$f" -mmin +60`
Looks funny to me, as a [[ conditional expression ]]
Tons of links on using them.

http://tldp.org/LDP/Bash-Beginners-G...ect_07_01.html
is one.

See if that helps.

Are you processing /proc with this lsof routine? Because it seems strange to me.

Last edited by Habitual; 05-16-2017 at 06:22 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Shell Script: "bash: Bad Substitution - Script for remove "." " thiagofw Programming 14 12-09-2016 10:04 PM
bash script to remove line from file that contains special character at the end boblc123 Programming 3 04-11-2014 09:51 AM
How to end the bash script using commands in bash not manually by pressing ctrl+c Sanpreet Singh Linux - Newbie 1 07-03-2013 01:04 PM
How to remove last charachter (last bit) from file? igorblackbelt Linux - Newbie 3 05-02-2007 12:29 PM
How to get rid of the begining and end space of a string for PERL?? cqmyg5 Slackware 2 04-28-2005 04:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration