Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-16-2018, 01:04 PM   #1
Registered: Sep 2016
Location: Webster MA USA
Posts: 231

Rep: Reputation: Disabled
bash script output doesn't change

Previous edits of the following:
set -xv
c=$(exiv2 -g Iptc.Application2.Caption -Pv "$file0")
if [[ ! -n $c ]]; then
	echo "File $1 has no Caption data."
	echo -e "$c"
exit 0
had an if/then subroutine using string manipulation in pure BASH, edited initially with a dollar sign misplaced. I edited the script, but when executed subsequently, even when pointing bash directly to the script, it still returns the misplaced fancy brackets, along with a ":2" (something else I put in the previous edit in the wrong place).

This happened before I set -xv and after. I saw this after adding the set
c='{"Kirsten," the ph...wn.":2}'
and as I say, those brackets and the misplaced number were edited out. I hope someone can duplicate this error.

Old 11-16-2018, 01:22 PM   #2
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,951

Rep: Reputation: 2146Reputation: 2146Reputation: 2146Reputation: 2146Reputation: 2146Reputation: 2146Reputation: 2146Reputation: 2146Reputation: 2146Reputation: 2146Reputation: 2146
maybe that is the output of the program you're using, try running it in the terminal to see what its output looks like, then you can strip off what you do not want.
is that set -x output or your script output?

if you are checking for NULL


    string is null, that is, has zero length

     String=''   # Zero-length ("null") string variable.

    if [ -z "$String" ]
      echo "\$String is null."
      echo "\$String is NOT null."
    fi     # $String is null.


    string is not null.

Last edited by BW-userx; 11-16-2018 at 02:01 PM.
Old 11-16-2018, 03:22 PM   #3
Registered: Sep 2016
Location: Webster MA USA
Posts: 231

Original Poster
Rep: Reputation: Disabled
I Google'd how to write the tags in exiv2 the fully correct way; on the manpage, I found out Captions and such can be set off with single quotes inside the double quotes that tell the binary what to do with the string or non-empty variable. I thought those double-quotes weren't supposed to have any "like" punctuation added to them. Now I found out I was wrong, and the script returns the right data.

I'll mark this Solved and be on my way until next time.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] [SOLVED] bash script: can echo command, command works if I type, but command doesn't work in script ... why? hopeless_n00b Linux - Newbie 10 07-12-2018 05:57 AM
[Solved] bash script doesn't create output file lukeer Programming 4 03-25-2016 09:23 PM
[SOLVED] Bash Script - Reading User Input while Processing output from Command within Bash cleeky Linux - General 5 05-27-2014 02:57 PM
How do I redirect output from bash script WITHIN script Robert S Linux - General 7 07-19-2013 10:42 AM
[SOLVED] Bash; awk or sed output to variable: how keep newline at end of each output line porphyry5 Programming 3 06-10-2011 05:50 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:13 AM.

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