When I run my script:
#!/usr/bin/env bash
read NUM
case $NUM in
1)
current_id = "$$"
ps -ef > file1.txt
echo "$current_id"
while [ $current_id -ne 1 ]
do
current_id =$( cat file1.txt | awk '(if ( $s == '$current_id' ) print $3;)')
echo " | "
echo " v "
echo $current_id
done
echo "";;
I get the error:
current_id: command not found
[: -ne: unary operator expected
I am trying to find the child-parent tree with this method. Is there something wrong with my syntax? Or is the current_id = "$$" not allowed? Thank for your help.