a simple app which just want to show some data in a list fails due to some of the variables are not initialized. to overcome this initialize the vars in the begining
here is an example script which fails without this fix. comments starting with # are marked as # in this
#!/bin/bash
source ../bashsimplecurses/simple_curses.sh
file=main.c
command_output() {
# Capture the output of the command
output=$(find ./ -name $file* | grep -v ".git"| cat -n)
# Display the output in the window
echo "$output"
}
show_win() {
# Initialize the screen
window "window" "blue"
count=find ./ -name $file* | grep -v "\.git"| wc -l
append "total numbers: $count"
addsep
# Call the command_output function to display the content
append_command "command_output"
# Display the window
endwin
}
a simple app which just want to show some data in a list fails due to some of the variables are not initialized. to overcome this initialize the vars in the begining
here is an example script which fails without this fix. comments starting with # are marked as # in this
#!/bin/bash
source ../bashsimplecurses/simple_curses.sh
file=main.c
command_output() { # Capture the output of the command output=$(find ./ -name $file* | grep -v ".git"| cat -n) # Display the output in the window echo "$output" }
show_win() { # Initialize the screen window "window" "blue" count=
find ./ -name $file* | grep -v "\.git"| wc -l
append "total numbers: $count" addsep # Call the command_output function to display the content append_command "command_output" # Display the window endwin }# Run the show_win function show_win
echo "done"