bash script to get current line and row not working

 If you're trying to create a Bash script to get the current line and row, but it's not working as expected, please provide more details or the specific code you're using so I can assist you more effectively. However, I can provide you with a basic example of how to get the current line number within a Bash script:


```bash

#!/bin/bash


current_line=$(caller 0 | awk '{print $1}')


echo "The current line number is: $current_line"

```


In this script:


1. We use the `caller` command to get information about the current line and call stack. `caller 0` retrieves information about the current line.


2. We use `awk` to extract the line number from the output of the `caller` command.


3. We then echo the current line number.


Please make sure your script is similar to this and check for any errors in your script that might be causing it not to work as expected. If you encounter specific errors or issues, feel free to provide more details for further assistance.

Comments

Popular posts from this blog

bad character U+002D '-' in my helm template

GitLab pipeline stopped working with invalid yaml error

How do I add a printer in OpenSUSE which is being shared by a CUPS print server?