LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   BASH Script - What am I doing wrong in this test? - BASH Script (https://www.linuxquestions.org/questions/programming-9/bash-script-what-am-i-doing-wrong-in-this-test-bash-script-4175603408/)

BW-userx 04-08-2017 09:45 AM

Quote:

Originally Posted by NevemTeve (Post 5694293)

going to make a liar out of me aren't you? I already said I was not going to post in here anymore.

The precious test script you insisted you had to have or you could not evaluate anything by using anything that I already posted.
Code:

#!/bin/bash

working_dir=/media/data/Deluge_Done
script_dir="~/scripts"

set -x


# to egt the file name so I can rename it
find "$working_dir" -type f  -name '*.flac'  | while read FILENAME
do

#get path - file name - extension

                f=$FILENAME
                path=${f%/*}
                xfile=${f##*/}
                title=${xfile%.*}
                ext=${xfile##*.}

#Set newFile name for converted flac to mp3

[[ "${ext}" == 'flac' ]] && NewFile="$title"."mp3"

[[ -f "${script_dir}"/"${NewFile}" ]] && resampledFileLoc="${script_dir}"/"${NewFile}"

printf "resampledFileLoc --> $resampledFileLoc\n"

exit 0

done

the test results
Code:

userx@slackwhere⚡~/scripts $./test-prove-point-script
+ find /media/data/Deluge_Done -type f -name '*.flac'
+ read FILENAME
+ f='/media/data/Deluge_Done/1979 - Public Image Ltd. - Metal Box [Virgin Vinyl 24-96 FLAC][2009][Kel Bazar]/01 - Albatross.flac'
+ path='/media/data/Deluge_Done/1979 - Public Image Ltd. - Metal Box [Virgin Vinyl 24-96 FLAC][2009][Kel Bazar]'
+ xfile='01 - Albatross.flac'
+ title='01 - Albatross'
+ ext=flac
+ [[ flac == \f\l\a\c ]]
+ NewFile='01 - Albatross.mp3'
+ [[ -f ~/scripts/01 - Albatross.mp3 ]] <----------
+ printf 'resampledFileLoc --> \n' <----------
resampledFileLoc --> <----------
+ exit 0

My Original post showing the error

Code:




now comes the check to insure that a file was re-sampled
Code:

 
+ [[ -f ~/scripts/01 - Albatross.mp3 ]] <----------
#
#  It tested true but did not set the variable The next line proves it.
#
+ printf '\n\n\ resampledFileLoc --> \n\n\n\n' <----------
\ resampledFileLoc --> <----------

#
# nothing was inside of it
#
+ [[ ! -z resampledFileLoc ]]
+ [[ -d '' ]]
+ [[ ! -z resampledFileLoc ]]
+ [[ -d '' ]]


do you notice any similarities whatsoever?

again that is a waste of my time to have done as you requested. As I stated WHY just so you can see the very same results of what I already posted?


again here is someone that surely does not need to live by someone else rule that obviously is not a complete true (brief) statement.


Quote:


where
Quote:

Quote:

Originally Posted by michaelk (Post 5694019)
Code:

script_dir="~/scripts"
With quotes the ~ is not being expanded to /home/username.


michaelk picked up on it. using what I gave out. That set me in the right direction to going back to using absolute path instead.
that made up requirement came from some lazy A$$ half baked thought.

so who now needs to recalibrate their belief system?

astrogeek 04-08-2017 12:07 PM

Quote:

Originally Posted by BW-userx (Post 5694297)
again that is a waste of my time to have done as you requested. As I stated WHY just so you can see the very same results of what I already posted?
...
again here is someone that surely does not need to live by someone else rule that obviously is not a complete true (brief) statement.
...
that made up requirement came from some lazy A$$ half baked thought.

so who now needs to recalibrate their belief system?

BW-userx, rude and insulting remarks, personal attacks and namecalling WILL NOT BE TOLERATED in this forum.

You consider it a waste of your time to provide simple answers to direct questions, yet you waste the time of everyone else who is trying to help you by not responding to their requests for ordinary clarification of your problem.

Please see, again, then basic rules of the forum, inclucing this:

Quote:

If you are unwilling or unable to ask questions in a manner that allows us to help you, it's unlikely our community will be able to provide you a solution. Unfortunately, serial offenders who show wanton disregard for this request after multiple pointers may be asked to seek help elsewhere.

BW-userx 04-08-2017 12:18 PM

Quote:

Originally Posted by astrogeek (Post 5694344)
BW-userx, rude and insulting remarks, personal attacks and namecalling WILL NOT BE TOLERATED in this forum.

You consider it a waste of your time to provide simple answers to direct questions, yet you waste the time of everyone else who is trying to help you by not responding to their requests for ordinary clarification of your problem.

Please see, again, then basic rules of the forum, inclucing this:

where were my remarks rude?

I was just pointing out truths.

I provided a proof to a remark to me that his request was not valid. where he kept on insisting that is was.

So I gave him Proof that No it was not valid that in fact he was in error of his thinking

where is the rudeness in that?

to prove someone wrong is not being rude

as far as this goes
"that made up requirement came from some lazy A$$ half baked thought."

it was to the one that made up that "rule" no one here in LQ did it that was from another web sight
stackoverflow

motivational psychology tells me that it was someone that is too lazy to put the effort into it themselves.
as well as if a person provides what I did then that does not need to be done. if at all. as I put forth proof to that effect.

that was a comment about some one that is not even in LQ but stackoverflow ....

BW-userx 04-08-2017 01:08 PM

@astrogeek

further more

Quote:

again here is someone that surely does not need to live by someone else rule that obviously is not a complete true (brief) statement.
that is a true statement as the user who is a moderator user name michaelk
figured it out without having me rewite an enter bash script to only show the same error as before it'd had been rewritten.


therefore that is a truth

please explain to me how telling the truth in your book as someone that is being rude?


Quote:

...
that made up requirement came from some lazy A$$ half baked thought.
that is about someone in stack exchange web sight ... let him defend himself if he wants to to me.
Quote:

so who now needs to recalibrate their belief system?

that is a question not a statement for one.

please explain to me how a question is being rude to someone in your book?

if someone makes a mistake in codding it is because they believed what they were doing was right.

then that someone comes in here and asks why is what I believe to be right not working?

others look at the problem see the error then corrects them because they where in error of their thinking that is why they were getting errors in their code.

so someone recalibrate that persons belief system by correcting them and showing them their errors and how to fix them


I did the same with not code but ones thinking


their is no difference in the methodology whatsoever only where it has been ap;plied.

where is the rudeness in showing ones fellow man their errors in thinking so they will no longer be in error of themselves in what they do, be it in what they are coding or how they are communicating to others?

because coding is too a form of communication same as someone communicating to another by whatever means.


It was a Question not a statement meant to bring a thought to someones mind After showing them their error in thinking .. that perhaps they need to rethink their belief about what one HAS to do for him in order to get him to be able to get the very same results that michaelk got when he did not have to have the same information given to him.

that being an entirely different script that will only reproduce the exact same error that I showed already and the code that did it.


all having to be put into a different bash script to get the exact same results. why ?

because that persons thinking is in error and it came from his belief system if you know how a belief system works that would help . I will explain that to you to help you better understand what it is that really happened here.

it is because that person held the belief that I ( and others) have to rewrite the code into a different file so that it only shows that one error so the one looking at the code that is throwing the error can be found easier.

an act of laziness because they do not want to have to go through all of that code to try and find it.

when a real coder has to.

I proved what was needed and then asked to give more.



if one picks out what is causing it and the error as a result of it. then no entirely new file is needed to be created.

I do not see this request for every question in Linux Questions for everyone that provides a question on why is this erroring on me?


so why is it that when I get this request more then once to the point I feel the need to show that person that his requested is invalid and prove it. then put to question that perhaps someone is in need to rethink what it is that they believe to be e truth when in fact it is not

because I proved it that it is not a necessary.

therefore proving that that belief is not a absolute truth.

to try and help someone in their thinking

that is all that was and that is it

and you see it as being RUDE?

Why?

astrogeek 04-08-2017 01:36 PM

This is neither a courtroom nor a kindergarten where we play games of, "Did too! Did not! Did too! Did not!", verbal misdirection and laying of blame.

This is a technical forum where we operate on a fully adult, respectful and cooperative level.

Please demonstrate that you are willing to do so.

This thread is now closed.


All times are GMT -5. The time now is 09:42 PM.