diff options
-rw-r--r-- | builtin.c | 27 | ||||
-rw-r--r-- | doc_src/eval.txt | 4 | ||||
-rw-r--r-- | share/functions/eval.fish | 4 |
3 files changed, 6 insertions, 29 deletions
@@ -2085,29 +2085,6 @@ static int builtin_status( wchar_t **argv ) /** - The eval builtin. Concatenates the arguments and calls eval on the - result. -*/ -static int builtin_eval( wchar_t **argv ) -{ - string_buffer_t sb; - int i; - int argc = builtin_count_args( argv ); - sb_init( &sb ); - - for( i=1; i<argc; i++ ) - { - sb_append( &sb, argv[i] ); - sb_append( &sb, L" " ); - } - - eval( (wchar_t *)sb.buff, block_io, TOP ); - sb_destroy( &sb ); - - return proc_get_last_status(); -} - -/** The exit builtin. Calls reader_exit to exit and returns the value specified. */ static int builtin_exit( wchar_t **argv ) @@ -3093,10 +3070,6 @@ const static builtin_data_t builtin_data[]= } , { - L"eval", &builtin_eval, N_( L"Evaluate parameters as a command" ) - } - , - { L"for", &builtin_for, N_( L"Perform a set of commands multiple times" ) } , diff --git a/doc_src/eval.txt b/doc_src/eval.txt index a662ebd6..68fc6fc9 100644 --- a/doc_src/eval.txt +++ b/doc_src/eval.txt @@ -1,10 +1,10 @@ -\section eval eval - eval the specified commands +\section eval eval - evaluate the specified commands \subsection eval-synopsis Synopsis <tt>eval [COMMANDS...]</tt> \subsection eval-description Description -The <tt>eval</tt> builtin causes fish to evaluate the specified parameters as a command. If more than one parameter is specified, all parameters will be joined using a space character as a separator. +The <tt>eval</tt> function causes fish to evaluate the specified parameters as a command. If more than one parameter is specified, all parameters will be joined using a space character as a separator. \subsection eval-example Example diff --git a/share/functions/eval.fish b/share/functions/eval.fish new file mode 100644 index 00000000..a8a8897d --- /dev/null +++ b/share/functions/eval.fish @@ -0,0 +1,4 @@ + +function eval -d "Evaluate parameters as a command" + echo -n $argv | . +end |