Skip to main content

Thread: how can i make this work


what have 2 command sets want reduce 1 single alias can not figure out how make them work

alias 1='mkdir temp && mv *.xbox.avi temp && rm * 2> /dev/null'
alias 2='cd temp && mv * .. && cd .. && rm -r temp'

problem last command in alias 1 produces error stops line had break 2 pieces, if 1 piece streamline lots of operations
please

if want delete /except/ .xbox.avi files, try this.

code:
rm $(ls | grep -v ".xbox.avi")
this command feed output of

code:
ls | grep -v ".xbox.avi"
into rm. ls list in folder, grep filter out , filenames ".xbox.avi" in name.

you'll still error regarding folders in folder run command in, that's silenceable redirect you're using.

oh, , if you'd prefer fix aliases have, add ; after rm command, rather double ampersand.

double ampersands mean "if previous command doesn't give error, run next command"
semi-colons mean "after previous command finishes, run next command"
double pipes ( || ) mean "if previous command gives error, run next command"

code:
alias 1='mkdir temp && mv *.xbox.avi temp && rm * 2> /dev/null; cd temp && mv * .. && cd .. && rm -r temp'


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [all variants] how can i make this work


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support