This is a shell script that changes to my code development directory and then lists the directorys and gives a numbered menu to enter a number and then change to that directory and launch vscode

You need to add an alias to your .bash_profile so that the script is sourced instead of being run in a new process. (remember to source your ~/.bash_profile to make the alias active)

Menu Script

#!/bin/bash

# /usr/local/bin/smenu.sh

PS3='Please enter your choice: '

# change to my development directory
cd ~/sites || {
	echo "Directory doesn't exist exiting"
	kill -INT $$
}

QUIT="Quit"

# glob for directories only
options=(*/)
# add the Quit option to the end of the array
options+=($QUIT)

# create the select menu
select opt in "${options[@]}"; do
	case $opt in
	# do something different if they choose quit
	$QUIT)
		echo "Quitting without changing directory"
		break
		;;

	# otherwise default is change directory
	*)
		echo "Changing Directory to $opt ($REPLY)"
		cd $opt
                vscode .
		break
		;;
	esac

done

Line to add to .bash_profile

# in ~/.bash_profile
alias smenu='. /usr/local/bin/smenu.sh'