Add backdir and ~"ls" alias
This commit is contained in:
parent
077c588d5a
commit
92e5a5201f
@ -51,6 +51,7 @@ at this moment!
|
|||||||
* File manipulation functions
|
* File manipulation functions
|
||||||
* move "file1" "file2" -> Renames/moves file1 to file2 (mv)
|
* move "file1" "file2" -> Renames/moves file1 to file2 (mv)
|
||||||
* chdir "/home/user" -> Changes directory to /home/user (cd)
|
* chdir "/home/user" -> Changes directory to /home/user (cd)
|
||||||
|
* backdir -> Moves you back one directory (..)
|
||||||
* showpath -> Returns current working directory (pwd alias)
|
* showpath -> Returns current working directory (pwd alias)
|
||||||
* showdir -> Lists current directory (ls alias)
|
* showdir -> Lists current directory (ls alias)
|
||||||
* showdir "/" -> lists '/'
|
* showdir "/" -> lists '/'
|
||||||
|
@ -52,6 +52,16 @@ char *process_line(char *line)
|
|||||||
else if(strncmp("exit", tok_srch, 4) == 0)
|
else if(strncmp("exit", tok_srch, 4) == 0)
|
||||||
syn_error("ss:exit called");
|
syn_error("ss:exit called");
|
||||||
|
|
||||||
|
// Change directory
|
||||||
|
else if(strncmp("backdir", tok_srch, 7) == 0)
|
||||||
|
{
|
||||||
|
int chdir_return = chdir("..");
|
||||||
|
if(chdir_return < 0)
|
||||||
|
{
|
||||||
|
syn_warn("ss:warn:backdir, failed to move directory location");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Move files using rename()
|
// Move files using rename()
|
||||||
else if(strncmp("move",tok_srch,4) == 0 || strncmp("mv", tok_srch, 2) == 0)
|
else if(strncmp("move",tok_srch,4) == 0 || strncmp("mv", tok_srch, 2) == 0)
|
||||||
{
|
{
|
||||||
@ -947,7 +957,7 @@ char *process_line(char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* system execute function */
|
/* system execute function */
|
||||||
else if(strncmp("exec",tok_srch,4) == 0)
|
else if(strncmp("exec", tok_srch, 4) == 0 || strncmp("~", tok_srch, 1) == 0)
|
||||||
{
|
{
|
||||||
char *cmd_line;
|
char *cmd_line;
|
||||||
int return_val;
|
int return_val;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user