mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
Replace the eval builtin with a function
darcs-hash:20070422221806-ac50b-28cffc6c3063c14cd8ab30f999e3530314c78af2.gz
This commit is contained in:
parent
ee94424b0f
commit
2c02b59703
3 changed files with 6 additions and 29 deletions
27
builtin.c
27
builtin.c
|
@ -2084,29 +2084,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.
|
||||
*/
|
||||
|
@ -3092,10 +3069,6 @@ const static builtin_data_t builtin_data[]=
|
|||
L"else", &builtin_else, N_( L"Evaluate block if condition is false" )
|
||||
}
|
||||
,
|
||||
{
|
||||
L"eval", &builtin_eval, N_( L"Evaluate parameters as a command" )
|
||||
}
|
||||
,
|
||||
{
|
||||
L"for", &builtin_for, N_( L"Perform a set of commands multiple times" )
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
4
share/functions/eval.fish
Normal file
4
share/functions/eval.fish
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
function eval -d "Evaluate parameters as a command"
|
||||
echo -n $argv | .
|
||||
end
|
Loading…
Reference in a new issue