Solved

Unix help

Posted on 2015-01-08
3
184 Views
Last Modified: 2015-01-19
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
Comment
Question by:magento
3 Comments
 
LVL 1

Assisted Solution

by:Mahesh Y
Mahesh Y earned 200 total points
ID: 40539598
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
 
LVL 5

Author Comment

by:magento
ID: 40540531
Mahesh,

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

Thanks
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 300 total points
ID: 40541001
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Postfix issues with spam/auth attempts under NAT 9 112
High Bandwidth Usage 6 75
How to install Ubuntu 16 in DELL venue 8 pro 20 290
awk sed 8 65
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question