by codejoust · 15y ago · 0 comments
!$ takes the last argument from the previous command, instead of the whole thing.
chmod 664 site/* - changes the permissions for all the files in the site directory. * is a wildcard in bash for specifying directories.
Another useful feature of bash is brace expansion: mv site{,-old} => mv site site-old The brace expansion expands the argument with the values in a comma separated list: college pic_00{1,4,3}.jpeg college.jpeg yields pic_001 pic_004, pic_003
> ls -a tmp
file1
file2
.file3
> ls tmp/*
file1
file2
> ls tmp/.*
.file3Just run mcd foobar and you (try) to create the directory and enter it. IMO a nice shortcut.
mcd dir1 dir2 dir3
That function will run: mkdir "dir1" "dir2" "dir3" cd "dir1" "dir2" "dir3"
(Surrounding $@ with double quotes, puts quotes around each item instead of quotes around the whole string: command "directory1/sub directory" "directory2"
$@ => directory1/sub directory directory2
"$@" => "directory1/sub directory" "directory2"
"$*" => "directory1/sub directory directory2"
)