Learn me something about bash that I don't know.
Tip : I already know a lot about it.
Will be back tomorrow to check if you brang me something useful.
NB:
- bash, not sh,zsh,ksh etc
- bash, not binaries invoked/combined from it
You can use it to cd into your code directory. I wrote a script to do just that.
>learn me something
>brang me something
You would be better off improving your knowledge of the English language.
>>57488879
#! is called shebang xddddddddd
>>57488879
> Learn me
Teach me*
>>57488879
at the top of your .bashrc goes this:shopt -s autocd
Now you can type
/tests/this/
If it is a file, then execute it like before. If it is a folder, then you cd into it.
>>57493756
damn, remove the last /
Iterate without seq
{1..5}
>>57494091
didn't know seq existed
for accepts{ ...; }instead ofdo ...; donebut while, until, and if don't.for i in {1..10}; { echo $i; }
You can use for withoutin list, it acts likein "$@"f() {
for a; do
echo $a
done
}
f {1..10}
find /var/www/html/ -type f -name "*.php" -exec grep -Hn "base64_" \;
find dem comps
Powershell is better than bash
>>57488879
Some bash fun facts:
>for loops accept any compound command, not just brace groups:f() for i; do echo "$i"; done
>some builtin names have special parsing rules that functions of the same name will inherit$ foo() { echo "$*"; }
$ foo a=(b)
bash: syntax error near unexpected token `('
$ declare() { echo "$*"; }
$ declare a=(b)
a
>You can create a file called /bin/bash$'\r' as a wrapper script to have it automatically run scripts with Windows CRLF line terminators
>>57488879wget a.li/fe
>>57488879
Fuck bash. POSIX shell 4lyfe.
>>57489029
holy shit
>>57498894
renew your domain fag
>>57488879
Daily reminder bash aliases or functions may invoke binaries invoked/combined from it, so in such case are explicitly forbidden.
So it looks like its bash builtins and keywords.
Daily reminder builtins may also have an associated binary, for exampletype -a printf
and in such a case, would also be excluded.
>>57498500
Fun fact: The local builtin does the same thing as declare, but will define "local" variables only recognized by a function and it's children.
Seehelp local
Set $EDITOR to your favourite terminal editor (vi, emacs, w/e), and use ^x + ^e to edit whatever is in your prompt, will get run on exit.
>>57493763
Too late damn you.
The nerve gas.
It burns.
>>57488879
Ctrl + l (I know is terminal stuff but still use full)
>>57488879
learn me :D
>>57499607
Ran muh linux mint for months like that, and it werked fine, before I realized there's "update-alternatives"sudo update-alternatives –config editor
Also, there's FCEDIT for the very cool fc builtin.
>>57488879
>learn me
>>learn me
>>>learn me
>>>>learn me
>>>>>learn me
>>>>>>learn me
>>>>>>>learn me
>>>>>>>>learn me
>>>>>>>>>learn me
>>>>>>>>>>learn me
>>>>>>>>>>>learn me
>>>>>>>>>>>>learn me
>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>>learn me
>>>>>>>>>>>>>learn me
>>>>>>>>>>>>learn me
>>>>>>>>>>>learn me
>>>>>>>>>>learn me
>>>>>>>>>learn me
>>>>>>>>learn me
>>>>>>>learn me
>>>>>>learn me
>>>>>learn me
>>>>learn me
>>>learn me
>>learn me
>>57499876
RUN WHILE YOU CAN
>>57499818
fuck. it's two dashes.
--config
Fun with bash:
compgen -a will list you're aliases
compgen -A function will list functions (-a is already taken)
compgen -b lists builtins (help <builtin>)
compgen -k keywords (help <keyword>)
compgen -c commands (man <command>)
Play with the whole shebang:
compgen -abckA function | grep foo
and maybe compgen -c | less because there's quite a few.
You wanna learn something new? zsh is better than bash.
>>57500176
compgen -a aliases (type <alias>)
compgen -A function ( -f is for file)
-a alias
-b builtins
-c commands
-d directory
-e exported shell variables
-f file
-g groups
-j jobs
-k keywords
-s service
-u userAlias names
-v shell variables
>>57488879
The following lines are all equivalent:
> >file echo hi hello
> echo >file hi hello
> echo hi >file hello
> echo hi hello >file
>man [
is this actually allowed?
>>57501383
Sure.
>>57501261
Damn. I've only ever used the last one.
>>57501383
type ! { [ [[
>>57501499
>this is a fork bomb
: is the best command. (It always succeeds).
help :
>>57501499
type . : [ [[ ]] ! { }
>>57501527
needs more ()
>>57501459
There's really no reason to use anything but the last one. This is more like something to look out for because it might happen in your script without you wanting it to.
>>57501709
petition to rename bin to ebin when
>>57501959
u mean sbin, right?
#!/usr/bin/env bash