Sample Header Ad - 728x90

gnome-terminal doesn't open tabs properly from my script

0 votes
2 answers
545 views
i have a script to launch gnome terminal with multiple tabs. The tabs are opened based on a list of directories listed in .tabs file that are in the same dir as the script. I create a string with several --tabs --working-directory /some/dir one for each line in the tabs file. before i run the command i echo it to the console. then i actually run it. Problem is gnome does open the tabs but it doesn't open each one in it's working directory. However if i copy-paste what i printed to the console it works great. i can't figure out why. here is the script: #!/bin/bash SCRIPT_DIR=$(dirname $(readlink -f $0)) declare -a profiles_list=() while [[ "$1" != "" ]] do profiles_list+=($1) shift done if [[ ${#profiles_list[@]} -eq 0 ]] then profiles_list+=("TERM_DEFAULT") fi TERM_LIST_PARAM="" for profile in ${profiles_list[@]} do file="${SCRIPT_DIR}/${profile}.tabs" if [[ ! -f $file ]] then echo $file does not exists fi while read tab do tab_line="--tab --working-directory='${tab}'" TERM_LIST_PARAM="$tab_line $TERM_LIST_PARAM" done < $file done echo gnome-terminal ${TERM_LIST_PARAM} gnome-terminal -v ${TERM_LIST_PARAM} echo $? exit 0
Asked by codeScriber (158 rep)
Apr 16, 2020, 02:28 PM
Last activity: Apr 16, 2020, 02:40 PM