Regular expression matching:
a=foobar
[[ "$a" =~ "^foo" ]] && echo "matches ^foo"
Array from a glob:
Regular expression matching:
a=foobar
[[ "$a" =~ "^foo" ]] && echo "matches ^foo"
Array from a glob:
# knife cheat | |
## Search Examples | |
knife search "name:ip*" | |
knife search "platform:ubuntu*" | |
knife search "platform:*" -a macaddress | |
knife search "platform:ubuntu*" -a uptime | |
knife search "platform:ubuntu*" -a virtualization.system | |
knife search "platform:ubuntu*" -a network.default_gateway |
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
Recipes | |
Note: the [main]$ bits on each line represents your bash prompt. You should only type the stuff after the $. | |
Set up the submodule for the first time: | |
[~]$ cd ~/main/ | |
[main]$ git submodule add git://github.com/my/submodule.git ./subm | |
[main]$ git submodule update --init | |
[main]$ git commit .gitmodules -m "Added submodule as ./subm" |
Example: You have a branch refactor
that is quite different from master
. You can't merge all of the
commits, or even every hunk in any single commit or master will break, but you have made a lot of
improvements there that you would like to bring over to master.
Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.
On master:
> git co -b temp