bash recursive xtrace

Is there any way to run bash script X so that if X call executable bash script Y then Y starts by 'sh -eux'?


echo OK


It is possible to make a subshell run using the same shell options set in the parent by exporting the SHELLOPTS environment variable.

In your case where and cannot be edited, I'd create a wrapper script that simply exports SHELLOPTS before calling


# example which calls


# example which needs to be called using sh -eux


#!/bin/sh -eux
# which sets the options for all sub shells

Calling directly shows that -eux options are not set in

[lsc@aphek]$ ./ 

Calling it via shows that the options have propagated to the subshells.

[lsc@aphek]$ ./ 
+ export SHELLOPTS
+ ./
+ ./
+ echo braceexpand:errexit:hashall:interactive-comments:nounset:posix:xtrace

Tested on GNU bash, version 3.00.15(1)-release. YMMV.

Need Your Help

Android ListView Vanishing Images

android image listview android-2.2-froyo

I have a ListView that I'm populating with names and images (if one exists) for each contact on my phone. This works fine when the app initially loads, but once I start to scroll through the ListV...

Views not rendered after transition event

javascript jquery jquery-mobile backbone.js

I'm currently trying to build an app using backbone, require.js & jqm. I'm new to jquery mobile an I'm having strange rendering issues and I'm not able to track them down or fix them. So my que...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.