Sample Header Ad - 728x90

Escape spaces in path in export variable (Ubuntu 22.04.1 LTS)

3 votes
2 answers
1993 views
I use WSL2 (Ubuntu 22.04.1 LTS) and need to refer to edge-browser for xdg-open. Due to the space in the path I get an error. How can I escape the space? The path is shown corrrectly in exported variable BROWSER. oliverk@KPW00WP3Q:/mnt/c/Users/E547766/Documents$ export BROWSER="/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" oliverk@KPW00WP3Q:/mnt/c/Users/E547766/Documents$ xdg-open https://stackoverflow.com/questions/24683221 /usr/bin/xdg-open: 882: /mnt/c/Program: not found /usr/bin/xdg-open: 882: /mnt/c/Program: not found xdg-open: no method available for opening 'https://stackoverflow.com/questions/24683221 ' oliverk@KPW00WP3Q:/mnt/c/Users/E547766/Documents$ export BROWSER='/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe' oliverk@KPW00WP3Q:/mnt/c/Users/E547766/Documents$ xdg-open https://stackoverflow.com/questions/24683221 /usr/bin/xdg-open: 882: /mnt/c/Program: not found /usr/bin/xdg-open: 882: /mnt/c/Program: not found xdg-open: no method available for opening 'https://stackoverflow.com/questions/24683221 ' oliverk@KPW00WP3Q:/mnt/c/Users/E547766/Documents$ $BROWSER -bash: /mnt/c/Program: No such file or directory oliverk@KPW00WP3Q:/mnt/c/Users/E547766/Documents$ export declare -x BROWSER="/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
Asked by Daniel (53 rep)
Aug 29, 2022, 07:08 PM
Last activity: Oct 11, 2024, 01:55 PM