mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-09 03:51:20 -03:00
Allow variables in commands
Syntax highlighting for these coming in next commit. Fixes #154
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
fish: Variables may not be used as commands. In fish, please define a function or use 'eval $test'.
|
||||
exec $test
|
||||
^
|
||||
fish: Variables may not be used as commands. In fish, please define a function or use 'eval "$test"'.
|
||||
exec "$test"
|
||||
^
|
||||
fish: The expanded command was empty.
|
||||
$EMPTY_VARIABLE
|
||||
^
|
||||
fish: The expanded command was empty.
|
||||
"$EMPTY_VARIABLE"
|
||||
^
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
# Test that using variables as command names work correctly.
|
||||
|
||||
# Both of these should generate errors about using variables as command names.
|
||||
# Verify that the expected errors are written to stderr.
|
||||
exec $test
|
||||
exec "$test"
|
||||
$EMPTY_VARIABLE
|
||||
"$EMPTY_VARIABLE"
|
||||
|
||||
set CMD1 echo basic command as variable
|
||||
$CMD1
|
||||
|
||||
set CMD2 echo '(' not expanded again
|
||||
$CMD2
|
||||
|
||||
# Test implicit cd
|
||||
set CMD3 /usr/bin
|
||||
$CMD3 && echo $PWD
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
basic command as variable
|
||||
( not expanded again
|
||||
/usr/bin
|
||||
|
||||
Reference in New Issue
Block a user