different exit codes at shell and in scripttar: Removing leading `/' from member namesWhy is my tar in a...

Beginner's snake game using PyGame

Accidentally cashed a check twice

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

Asking for something with different prices

What does it mean by "d-ism of Leibniz" and "dotage of Newton" in simple English?

The deliberate use of misleading terminology

Can you use a concentration spell while using Mantle of Majesty?

Relativistic resistance transformation

How crucial is a waifu game storyline?

How can I offer a test ride while selling a bike?

What if you don't bring your credit card or debit for incidentals?

Does Peach's float negate shorthop knockback multipliers?

What does the behaviour of water on the skin of an aircraft in flight tell us?

Are academic associations obliged to comply with the US government?

Are there mythical creatures in the world of Game of Thrones?

Recording the inputs of a command and producing a list of them later on

Why don't I have ground wiring on any of my outlets?

Why does my electric oven present the option of 40A and 50A breakers?

How can I grammatically understand "Wir über uns"?

Working in the USA for living expenses only; allowed on VWP?

Applicants clearly not having the skills they advertise

Why is there a need to modify system call tables in Linux?

California: "For quality assurance, this phone call is being recorded"

Select row of data if next row contains zero



different exit codes at shell and in script


tar: Removing leading `/' from member namesWhy is my tar in a script behaving different than using tar manuallyParent script continues when child exits with non-zero exit codeUsing “reserved” codes for exit status of shell scriptsPrivilegies of command inside shell scriptDifferent behavior in shell script vs in shell?shell script if condition not working as expectedWhy isn't my .bashrc file being read from .profileServer response login error!Why do I get different exit status for ps | grep in a script?Issue with booleans tests && and || in bash






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







0















The following block executes fine in script but gives exit code 1.
But when i run this at shell prompt executes fine with message




tar: Removing leading `/' from member names




and gives exit code 0. Why it is behaving differently. How to fix this to avoid exit code 1 when run using script.



tar -czf $tracedir/dbtrace.tar.gz $tracedir

status=$?

if [ $status -ne 0 ]; then
echo "The error code is---"$status >> output.log
fi









share|improve this question

























  • Possible duplicate of tar: Removing leading `/' from member names

    – Inian
    8 mins ago











  • In both cases it works fine, but i want to avoid exit code 1 when i run using script

    – user2439245
    41 secs ago


















0















The following block executes fine in script but gives exit code 1.
But when i run this at shell prompt executes fine with message




tar: Removing leading `/' from member names




and gives exit code 0. Why it is behaving differently. How to fix this to avoid exit code 1 when run using script.



tar -czf $tracedir/dbtrace.tar.gz $tracedir

status=$?

if [ $status -ne 0 ]; then
echo "The error code is---"$status >> output.log
fi









share|improve this question

























  • Possible duplicate of tar: Removing leading `/' from member names

    – Inian
    8 mins ago











  • In both cases it works fine, but i want to avoid exit code 1 when i run using script

    – user2439245
    41 secs ago














0












0








0








The following block executes fine in script but gives exit code 1.
But when i run this at shell prompt executes fine with message




tar: Removing leading `/' from member names




and gives exit code 0. Why it is behaving differently. How to fix this to avoid exit code 1 when run using script.



tar -czf $tracedir/dbtrace.tar.gz $tracedir

status=$?

if [ $status -ne 0 ]; then
echo "The error code is---"$status >> output.log
fi









share|improve this question
















The following block executes fine in script but gives exit code 1.
But when i run this at shell prompt executes fine with message




tar: Removing leading `/' from member names




and gives exit code 0. Why it is behaving differently. How to fix this to avoid exit code 1 when run using script.



tar -czf $tracedir/dbtrace.tar.gz $tracedir

status=$?

if [ $status -ne 0 ]; then
echo "The error code is---"$status >> output.log
fi






shell-script rhel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 8 mins ago









Inian

6,2201633




6,2201633










asked 10 mins ago









user2439245user2439245

143




143













  • Possible duplicate of tar: Removing leading `/' from member names

    – Inian
    8 mins ago











  • In both cases it works fine, but i want to avoid exit code 1 when i run using script

    – user2439245
    41 secs ago



















  • Possible duplicate of tar: Removing leading `/' from member names

    – Inian
    8 mins ago











  • In both cases it works fine, but i want to avoid exit code 1 when i run using script

    – user2439245
    41 secs ago

















Possible duplicate of tar: Removing leading `/' from member names

– Inian
8 mins ago





Possible duplicate of tar: Removing leading `/' from member names

– Inian
8 mins ago













In both cases it works fine, but i want to avoid exit code 1 when i run using script

– user2439245
41 secs ago





In both cases it works fine, but i want to avoid exit code 1 when i run using script

– user2439245
41 secs 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%2f521886%2fdifferent-exit-codes-at-shell-and-in-script%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%2f521886%2fdifferent-exit-codes-at-shell-and-in-script%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...