• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Unix help

Hi Experts,

I see in perl logs, it will tell what functions its calling using caller function and also we can see the trace of the code.

In same way is it possible in shell script we can trace the code in logs  ?

Thanks for your help in advance.

Thanks
0
magento
Asked:
magento
2 Solutions
 
Mahesh YCommented:
If it is a bash script..You can enable debug mode by adding set -x below shebang or run the script with bash -x <script>
0
 
magentoAuthor Commented:
Mahesh,

Yes, please explain how to get them in the logs when the bash script moved to production.

Thanks
0
 
omarfaridCommented:
you can put

#!/bin/bash -x

at the beginning of your script and this will display commands on screen while running script. If you want this to be sent to logs file then you can redirect the script like:

/path/to/script >> /path/to/logs 2>&1
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now