Bash String Concat issues [duplicate]bash string extractionWhy does bash add single quotes to unquoted failed...

What is the "ls" directory in my home directory?

Can the pre-order traversal of two different trees be the same even though they are different?

Why is oilcloth made with linseed oil?

In the US, can a former president run again?

Should the party get XP for a monster they never attacked?

Why don't we have a weaning party like Avraham did?

What happened to Hopper's girlfriend in season one?

Print one file per line using echo

Draw a symmetric alien head

What is the meaning of "понаехать"?

How do internally carried IR missiles acquire a lock?

Can i enter UK for 24 hours from a Schengen area holding an Indian passport?

Proving an Intuitive Result Rigorously

Text alignment in tikzpicture

Exact functors and derived functors

Umlaut character order when sorting

"Correct me if I'm wrong"

What are Elsa's reasons for selecting the Holy Grail on behalf of Donovan?

How do I remove this inheritance-related code smell?

A word for delight at someone else's failure?

Has a life raft ever been successfully deployed on a modern commercial flight?

Is there a name for the trope when there is a moments dialogue when someone pauses just before they leave the room?

What was the first third-party commercial application for MS-DOS?

What are the current battlegrounds for people’s “rights” in the UK?



Bash String Concat issues [duplicate]


bash string extractionWhy does bash add single quotes to unquoted failed pathname expansions in a command before executing it?Can't concat file paths, permission deniedbreaking out of command loop but exit code not the reason?How to use bash's complete or compgen -C (command) option?compare string in bashSet comparator with variables within a variable, then have shell expand those variables each time it's echo'dHow to prevent parameter expansion around a variable I want to be resolved?Bash String manipulation when string contains parenthesesBash Script general questions






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0
















This question already has an answer here:




  • How can we run a command stored in a variable?

    3 answers



  • Why does my shell script choke on whitespace or other special characters?

    4 answers




What seems to be going on here with the single quotes that are getting added to my concat'ed string? Something caused by the expansion of close($i)?



   for i in ${pid_fd_arr=[@]}
do
close_cmd+=" -ex "
close_cmd+="p close($i)"
done
close_cmd+=" -ex detach -ex quit"
echo $close_cmd


After all is said and done I see the following:



gdb --pid 1826 -batch -ex p 'close(15)' -ex detach -ex quit


The single quotes around close is causing the execution of this string to break. Any help would be greatly appreciated.



Desired:
gdb --pid 1826 -batch -ex 'p close(15)' -ex detach -ex quit










share|improve this question







New contributor



Griff0417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
3 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

























    0
















    This question already has an answer here:




    • How can we run a command stored in a variable?

      3 answers



    • Why does my shell script choke on whitespace or other special characters?

      4 answers




    What seems to be going on here with the single quotes that are getting added to my concat'ed string? Something caused by the expansion of close($i)?



       for i in ${pid_fd_arr=[@]}
    do
    close_cmd+=" -ex "
    close_cmd+="p close($i)"
    done
    close_cmd+=" -ex detach -ex quit"
    echo $close_cmd


    After all is said and done I see the following:



    gdb --pid 1826 -batch -ex p 'close(15)' -ex detach -ex quit


    The single quotes around close is causing the execution of this string to break. Any help would be greatly appreciated.



    Desired:
    gdb --pid 1826 -batch -ex 'p close(15)' -ex detach -ex quit










    share|improve this question







    New contributor



    Griff0417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.










    marked as duplicate by Kusalananda bash
    Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    3 hours ago


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      0












      0








      0









      This question already has an answer here:




      • How can we run a command stored in a variable?

        3 answers



      • Why does my shell script choke on whitespace or other special characters?

        4 answers




      What seems to be going on here with the single quotes that are getting added to my concat'ed string? Something caused by the expansion of close($i)?



         for i in ${pid_fd_arr=[@]}
      do
      close_cmd+=" -ex "
      close_cmd+="p close($i)"
      done
      close_cmd+=" -ex detach -ex quit"
      echo $close_cmd


      After all is said and done I see the following:



      gdb --pid 1826 -batch -ex p 'close(15)' -ex detach -ex quit


      The single quotes around close is causing the execution of this string to break. Any help would be greatly appreciated.



      Desired:
      gdb --pid 1826 -batch -ex 'p close(15)' -ex detach -ex quit










      share|improve this question







      New contributor



      Griff0417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      This question already has an answer here:




      • How can we run a command stored in a variable?

        3 answers



      • Why does my shell script choke on whitespace or other special characters?

        4 answers




      What seems to be going on here with the single quotes that are getting added to my concat'ed string? Something caused by the expansion of close($i)?



         for i in ${pid_fd_arr=[@]}
      do
      close_cmd+=" -ex "
      close_cmd+="p close($i)"
      done
      close_cmd+=" -ex detach -ex quit"
      echo $close_cmd


      After all is said and done I see the following:



      gdb --pid 1826 -batch -ex p 'close(15)' -ex detach -ex quit


      The single quotes around close is causing the execution of this string to break. Any help would be greatly appreciated.



      Desired:
      gdb --pid 1826 -batch -ex 'p close(15)' -ex detach -ex quit





      This question already has an answer here:




      • How can we run a command stored in a variable?

        3 answers



      • Why does my shell script choke on whitespace or other special characters?

        4 answers








      bash shell-script






      share|improve this question







      New contributor



      Griff0417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question







      New contributor



      Griff0417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question






      New contributor



      Griff0417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 3 hours ago









      Griff0417Griff0417

      1




      1




      New contributor



      Griff0417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Griff0417 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      marked as duplicate by Kusalananda bash
      Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      3 hours ago


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Kusalananda bash
      Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      3 hours ago


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























          0






          active

          oldest

          votes

















          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes

          Popular posts from this blog

          Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

          The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

          Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...