LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-13-2022, 01:19 PM   #16
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,619

Rep: Reputation: 2555Reputation: 2555Reputation: 2555Reputation: 2555Reputation: 2555Reputation: 2555Reputation: 2555Reputation: 2555Reputation: 2555Reputation: 2555Reputation: 2555

Quote:
Originally Posted by dalacor View Post
Can't see what bug you mean.
Which is all the more reason to use existing well-tested tools as much as possible - the less code one needs to write to achieve a task, the lower the chance of bugs creeping in.

If you run ShellCheck against the script it will highlight "Double quote to prevent globbing and word splitting." - whilst this is only listed as "info" (because ShellCheck doesn't know what variables contain) any time a variable contains a filename, it is a bug in the script, because certain filenames will cause errors.

Another example - if your grep still looks what Pan quoted in post #14 then there's probably a bug there, because it's not doing a whole line match. That's also easily fixable, but if you can instead replace the whole while/grep section with something based on either of the commands in post #7 then that's even less code...


Last edited by boughtonp; 07-13-2022 at 01:20 PM.
 
Old 07-14-2022, 05:09 AM   #17
dalacor
Member
 
Registered: Feb 2019
Distribution: Slackware
Posts: 173

Original Poster
Rep: Reputation: Disabled
I see what you mean now. I do find Linux quite temperamental about file names and paths compared to Windows. I will fix that thank you.
 
Old 07-14-2022, 05:27 AM   #18
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,996

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
Quote:
Originally Posted by dalacor View Post
I see what you mean now. I do find Linux quite temperamental about file names and paths compared to Windows. I will fix that thank you.
No, it is not true. Windows tries to be much more user-friendly by hiding the complexity of the underlying mechanisms with some built-in features (like automatic handling of "weird" characters like spaces in filenames and paths), which ultimately makes it even more inscrutable.
 
Old 07-14-2022, 05:56 AM   #19
dalacor
Member
 
Registered: Feb 2019
Distribution: Slackware
Posts: 173

Original Poster
Rep: Reputation: Disabled
Whichever way you like to look at it. I just like the fact that I can type cd \program files or cd \Program Files and it will get me there, whereas Linux will not tolerate me typing a path in lower case when I should be typing caps and vice versa. I am a Windows person, so naturally I will find Linux harder to use than Windows - not because one is easier/harder than the other, but more because I am used to how Windows works.

I have run the shellcheck. Really good idea (and I will use that in future). It has shown me where to double quote which I have now fixed. It shows everything else as correct, apart from recommending grep -q and SC2001 to use ${variable//search/replace} instead. I am not fussed about grep -q (as the output is handy) and SC2001 just seems to be another way to do the same thing without sed. I might as well change that as the coding is a lot easier to read than using sed.
 
Old 07-14-2022, 06:09 AM   #20
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,996

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
Quote:
Originally Posted by dalacor View Post
Whichever way you like to look at it. I just like the fact that I can type cd \program files or cd \Program Files and it will get me there, whereas Linux will not tolerate me typing a path in lower case when I should be typing caps and vice versa. I am a Windows person, so naturally I will find Linux harder to use than Windows - not because one is easier/harder than the other, but more because I am used to how Windows works.
Windows is not linux and linux is not windows. https://linux.oneandoneis2.org/LNW.htm
Obviously you are allowed to like (prefer) windows, in that case use windows.

Quote:
Originally Posted by dalacor View Post
I have run the shellcheck. Really good idea (and I will use that in future). It has shown me where to double quote which I have now fixed. It shows everything else as correct, apart from recommending grep -q and SC2001 to use ${variable//search/replace} instead. I am not fussed about grep -q (as the output is handy) and SC2001 just seems to be another way to do the same thing without sed. I might as well change that as the coding is a lot easier to read than using sed.
https://github.com/koalaman/shellcheck/issues/1768
this is not just another way to do the same thing, but a more efficient way.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare two files and determine the reason of differences vamosrafa360 Linux - Software 12 08-05-2018 08:23 AM
[SOLVED] How to compare a list of files in two directories: compare content and print size Batistuta_g_2000 Linux - Newbie 9 03-24-2013 07:05 AM
Compare file extension from two different txt file and find the differences. Neal000 Programming 6 08-28-2012 02:03 PM
Tool like diff to compare two files & make graphical output highlighting differences? kmkocot Linux - Newbie 1 08-02-2012 09:26 PM
[SOLVED] Trying to compare two files and output it into a third file. chutsu Programming 11 07-31-2009 06:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:36 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