Change $(basename “$0”) Output From Executed base64 EncodeWhy does sh display an error when bash does...

Would molten tin solidify and coat an organic horn?

What is the purpose/function of this power inductor in parallel?

6502: is BCD *fundamentally* the same performance as non-BCD?

May the tower use the runway while an emergency aircraft is inbound?

What are the advantages of this gold finger shape?

Minimum population for language survival

How do I pass a "list of lists" as the argument to a function of the form F[x,y]?

Is there any official ruling on how characters go from 0th to 1st level in a class?

Short comic about alien explorers visiting an abandoned world with giant statues that turn out to be alive but move very slowly

What are some tips and tricks for finding the cheapest flight when luggage and other fees are not revealed until far into the booking process?

Doesn't the speed of light limit imply the same electron can be annihilated twice?

When did Bilbo and Frodo learn that Gandalf was a Maia?

Can a countable set contain uncountably many infinite subsets such that the symmetric difference of any two such distinct subsets is finite?

Why is the battery jumpered to a resistor in this schematic?

Visa on arrival to exit airport in Russia

Are there any cons in using rounded corners for bar graphs?

Is Fourier series a sampled version of Fourier transform?

Unconventional examples of mathematical modelling

Airline power sockets shut down when I plug my computer in. How can I avoid that?

Why does "auf der Strecke bleiben" mean "to fall by the wayside"?

How to train a replacement without them knowing?

Scam? Phone call from "Department of Social Security" asking me to call back

Output with the same length always

How would armour (and combat) change if the fighter didn't need to actually wear it?



Change $(basename “$0”) Output From Executed base64 Encode


Why does sh display an error when bash does not?shell calling another shell program fails when run by crontabPM2 inside bash script deployed by puppet not workingApply SHA256 and Base64 to string in scriptRemove leading whitespace before possible shebangUse asterisk in variablesUse stdout, for run with sudoMake an alias or shortcut to do more than one command several times






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







2















Inside script.sh



echo $(basename "$0")


Then I Encoded script.sh using base64:



echo '#!/usr/bin/env bash' > other.sh  
echo "echo '$(base64 script.sh)' | base64 -d | sh" >> other.sh


Why doesn't it not displaying "script.sh" as basename "$0" when i run "other.sh"?

But instead it displays "sh"

How to make it display script.sh?










share|improve this question






















  • 1





    Just as a general point in script writing, whenever you have echo $(command) you're better off to say simply command. So script.sh could be just: basename "$0"

    – Jim L.
    yesterday













  • @JimL. Can you give me an explain?

    – IISomeOneII
    yesterday






  • 1





    Try: basename "/bin/sh" Now try: echo "$(basename "/bin/sh")" Those commands do exactly the same thing, but the first one is better, and the second one is inefficient.

    – Jim L.
    yesterday











  • @JimL. It's not work

    – IISomeOneII
    20 hours ago


















2















Inside script.sh



echo $(basename "$0")


Then I Encoded script.sh using base64:



echo '#!/usr/bin/env bash' > other.sh  
echo "echo '$(base64 script.sh)' | base64 -d | sh" >> other.sh


Why doesn't it not displaying "script.sh" as basename "$0" when i run "other.sh"?

But instead it displays "sh"

How to make it display script.sh?










share|improve this question






















  • 1





    Just as a general point in script writing, whenever you have echo $(command) you're better off to say simply command. So script.sh could be just: basename "$0"

    – Jim L.
    yesterday













  • @JimL. Can you give me an explain?

    – IISomeOneII
    yesterday






  • 1





    Try: basename "/bin/sh" Now try: echo "$(basename "/bin/sh")" Those commands do exactly the same thing, but the first one is better, and the second one is inefficient.

    – Jim L.
    yesterday











  • @JimL. It's not work

    – IISomeOneII
    20 hours ago














2












2








2








Inside script.sh



echo $(basename "$0")


Then I Encoded script.sh using base64:



echo '#!/usr/bin/env bash' > other.sh  
echo "echo '$(base64 script.sh)' | base64 -d | sh" >> other.sh


Why doesn't it not displaying "script.sh" as basename "$0" when i run "other.sh"?

But instead it displays "sh"

How to make it display script.sh?










share|improve this question
















Inside script.sh



echo $(basename "$0")


Then I Encoded script.sh using base64:



echo '#!/usr/bin/env bash' > other.sh  
echo "echo '$(base64 script.sh)' | base64 -d | sh" >> other.sh


Why doesn't it not displaying "script.sh" as basename "$0" when i run "other.sh"?

But instead it displays "sh"

How to make it display script.sh?







shell-script






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







IISomeOneII

















asked yesterday









IISomeOneIIIISomeOneII

1301 silver badge13 bronze badges




1301 silver badge13 bronze badges











  • 1





    Just as a general point in script writing, whenever you have echo $(command) you're better off to say simply command. So script.sh could be just: basename "$0"

    – Jim L.
    yesterday













  • @JimL. Can you give me an explain?

    – IISomeOneII
    yesterday






  • 1





    Try: basename "/bin/sh" Now try: echo "$(basename "/bin/sh")" Those commands do exactly the same thing, but the first one is better, and the second one is inefficient.

    – Jim L.
    yesterday











  • @JimL. It's not work

    – IISomeOneII
    20 hours ago














  • 1





    Just as a general point in script writing, whenever you have echo $(command) you're better off to say simply command. So script.sh could be just: basename "$0"

    – Jim L.
    yesterday













  • @JimL. Can you give me an explain?

    – IISomeOneII
    yesterday






  • 1





    Try: basename "/bin/sh" Now try: echo "$(basename "/bin/sh")" Those commands do exactly the same thing, but the first one is better, and the second one is inefficient.

    – Jim L.
    yesterday











  • @JimL. It's not work

    – IISomeOneII
    20 hours ago








1




1





Just as a general point in script writing, whenever you have echo $(command) you're better off to say simply command. So script.sh could be just: basename "$0"

– Jim L.
yesterday







Just as a general point in script writing, whenever you have echo $(command) you're better off to say simply command. So script.sh could be just: basename "$0"

– Jim L.
yesterday















@JimL. Can you give me an explain?

– IISomeOneII
yesterday





@JimL. Can you give me an explain?

– IISomeOneII
yesterday




1




1





Try: basename "/bin/sh" Now try: echo "$(basename "/bin/sh")" Those commands do exactly the same thing, but the first one is better, and the second one is inefficient.

– Jim L.
yesterday





Try: basename "/bin/sh" Now try: echo "$(basename "/bin/sh")" Those commands do exactly the same thing, but the first one is better, and the second one is inefficient.

– Jim L.
yesterday













@JimL. It's not work

– IISomeOneII
20 hours ago





@JimL. It's not work

– IISomeOneII
20 hours ago










0






active

oldest

votes














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f535718%2fchange-basename-0-output-from-executed-base64-encode%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f535718%2fchange-basename-0-output-from-executed-base64-encode%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...