On http://communities.vmware.com/thread/258207, RParker says:
"But you shouldn't be uploading ISO to the datastore anyway, users can mount ISO from their client, or you can create an NFS store, and connect your ESX hosts to it."
But...
Select your host.
Click on the "Storage Views" tab (grey tab on the far right at the top)
Click on a Datastore in the list.
In the explorer pane list on the left you will get a list of the datastores.
Right Click on the one that you want, and click "Browse Datastore..."
In here you can create new folders, upload new files & delete files from disk.
Then you can connect to them as if they're a DVD drive.
A place for John to record his techy notes, both to refer back to when needed, and as a help for others...
Monday, May 09, 2011
Friday, May 06, 2011
Entry for local iso in /etc/apt/sources.list
deb file:///mnt/ubuntu-iso jaunty main restricted
(This was an Ubuntu BSD box and the iso was mounted under /mnt/ubuntu-iso)
http://ubuntuforums.org/archive/index.php/t-35807.html
(This was an Ubuntu BSD box and the iso was mounted under /mnt/ubuntu-iso)
http://ubuntuforums.org/archive/index.php/t-35807.html
Friday, April 08, 2011
Turning off Passive mode in FTP
Curl:
From the cURL man page here: http://curl.haxx.se/docs/manpage.html#-P--ftp-port
or you can add:
to your ~/.curlrc
For lftp you can add this to ~/.lftprc:
Or just type the same command at the lftp prompt if you only want it for the current session.
curl -O -P- ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/xz-5.0.1-sol10-sparc-local.gz
From the cURL man page here: http://curl.haxx.se/docs/manpage.html#-P--ftp-port
or you can add:
-P-
to your ~/.curlrc
For lftp you can add this to ~/.lftprc:
set ftp:passive-mode off
Or just type the same command at the lftp prompt if you only want it for the current session.
Thursday, March 17, 2011
File descriptors for read loops...
while read with a command that eats input (ssh, another read etc)
for file:
In ksh:
in bash:
ksh: http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2003-05/0889.html
bash: http://forums.devshed.com/unix-help-35/bash-scripting-using-file-descriptors-154812.html
for file:
$ cat $tempfile
a b
c d
e f
g h
In ksh:
#!/bin/ksh
exec 4<$tempfile
while read -u4 first second
do
echo first=$first
echo second=$second
printf "number?: "
read NUM
echo "name=$NUM"
ssh localhost uname 2>/dev/null
done
in bash:
#!/bin/bash
exec 4<$tempfile
while read <&4 first second
do
echo first=$first
echo second=$second
printf "number?: "
read NUM
echo "name=$NUM"
ssh localhost uname 2>/dev/null
done
exec 4<&-
ksh: http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2003-05/0889.html
bash: http://forums.devshed.com/unix-help-35/bash-scripting-using-file-descriptors-154812.html
Wednesday, March 16, 2011
Repeat after me, awk is not Perl...
What does a semicolon mean to awk?
This works:
but this doesn't:
and this does:
and just to prove it's REALLY niggly, it's fussy about the order you give it things too:
while this works fine:
This works:
$ /usr/bin/ps -ef | awk '/ root\ /{p++};END{print p}'
but this doesn't:
$ /usr/bin/ps -ef | awk 'BEGIN{p=0};/ root\ /{p++}END{print p}'
awk: syntax error near line 1
awk: bailing out near line 1
and this does:
$ /usr/bin/ps -ef | awk 'BEGIN{p=0}/ root\ /{p++}END{print p}'
0
and just to prove it's REALLY niggly, it's fussy about the order you give it things too:
$ /usr/bin/ps -ef | awk '/ root\ /{p++}BEGIN{p=0}END{print p}'
awk: syntax error near line 1
awk: bailing out near line 1
while this works fine:
$ /usr/bin/ps -ef | awk 'BEGIN{p=0}END{print p}'
0
Wednesday, March 02, 2011
Backticks can be dangerous!
For years I've preferred to use
rather than
while shell scripting.
For me it was mostly a matter of style, but I pretty much thought that the two were equivalents.
I felt it was a bit easier to see $(...) than `...` and sometimes I need to nest commands with:
which would be impossible with backticks.
THEY ARE NOT THE SAME!
Don't blame ksh, it does the same in bash and Bourne shell.
(although $( ) syntax is not valid in Bourne shell)
Solaris:
Linux:
More testing:
$(command)
rather than
`command`
while shell scripting.
For me it was mostly a matter of style, but I pretty much thought that the two were equivalents.
I felt it was a bit easier to see $(...) than `...` and sometimes I need to nest commands with:
$(command $(othercommand))
which would be impossible with backticks.
THEY ARE NOT THE SAME!
#!/bin/ksh
#
#
#
for STRING in 'sample.txt' 'File: C:\\path\\to\\file.txt|Something else'
do
printf "result: "
echo "$STRING" | sed 's/^[^|]*\\\([^\\]*\)|.*$/\1/g'
echo 1
VAR_1=$(echo "$STRING" | sed 's/^[^|]*\\\([^\\]*\)|.*$/\1/g')
echo 2
VAR_2=`echo "$STRING" | sed 's/^[^|]*\\\([^\\]*\)|.*$/\1/g'`
echo 3
VAR_3=`echo "$STRING" | sed "s/^[^|]*\\\([^\\]*\)|.*$/\1/g"`
echo 4
VAR_4=`echo "$STRING" | sed 's/^[^|]*\\\\\([^\\]*\\)|.*$/\1/g'`
cat <<EOT
VAR_1: '$VAR_1'
VAR_2: '$VAR_2'
VAR_3: '$VAR_3'
VAR_4: '$VAR_4'
EOT
done
Don't blame ksh, it does the same in bash and Bourne shell.
(although $( ) syntax is not valid in Bourne shell)
Solaris:
$ uname -a
SunOS umurxd04 5.10 Generic_137138-09 i86pc i386 i86pc
$ ./try.sh
result: sample.txt
1
2
sed: command garbled: s/^[^|]*\\([^\]*\)|.*$/\1/g
3
4
VAR_1: 'sample.txt'
VAR_2: ''
VAR_3: 'sample.txt'
VAR_4: 'sample.txt'
result: file.txt
1
2
sed: command garbled: s/^[^|]*\\([^\]*\)|.*$/\1/g
3
4
VAR_1: 'file.txt'
VAR_2: ''
VAR_3: ''
VAR_4: 'file.txt'
Linux:
$ ./try.sh
sample.txt
1
2
sed: -e expression #1, char 27: Unmatched ) or \)
3
4
VAR_1: 'sample.txt'
VAR_2: ''
VAR_3: 'sample.txt'
VAR_4: 'sample.txt'
file.txt
1
2
sed: -e expression #1, char 27: Unmatched ) or \)
3
4
VAR_1: 'file.txt'
VAR_2: ''
VAR_3: ''
VAR_4: 'file.txt'
More testing:
ksh $ echo `echo '\\'`
\
ksh $ echo `echo "\\"`
"
ksh $ echo `echo "\\\"`
\
ksh $ echo $(echo '\\')
\
ksh $ echo $(echo "\\")
\
ksh $ echo $(echo "\\\")
>
> ^C
bash $ echo `echo '\\'`
\
bash $ echo `echo "\\"`
bash: command substitution: line 1: unexpected EOF while looking for matching `"'
bash: command substitution: line 2: syntax error: unexpected end of file
bash $ echo `echo "\\\"`
\
bash $ echo $(echo '\\')
\\
bash $ echo $(echo "\\")
\
bash $ echo $(echo "\\\")
>
>
Thursday, January 27, 2011
git bits...
- Alexander Zeitler’s Git Cheat Sheet
- Zach Rusin’s Git Cheat Sheet
- http://cheat.errtheblog.com/s/git/
- Nate Murray’s Git Cheat Sheet
- http://www.codingdomain.com/git/tricks/
- http://help.github.com/git-cheat-sheets/
- https://git.wiki.kernel.org/index.php/Aliases
Cheat sheets
http://www.draconianoverlord.com/2010/03/04/git-config.html
http://www.sourcemage.org/Git_Guide
http://cheat.errtheblog.com/s/git
http://www.gitready.com/intermediate/2009/02/06/helpful-command-aliases.html
Toggle Character Codes
In Windows, when you enter text you can press Alt-X after it to show the hex for that character. (inversely you can type a number and do Alt-X to make the character, or hold Alt & type the number on the numeric keypad to get the character)
Tuesday, January 18, 2011
How to expand * on bash command line
<Esc>* in set -o vior
<Ctrl-X>* in standard bashhttp://superuser.com/questions/215950/how-to-expand-on-bash-command-line
Wednesday, January 12, 2011
vim one liner to convert backslashes in clipboard to percents
Windows clipboard modifier in vim...
I was exporting a whole lot of registry entries in Windows.
I would do F3 to find the next match, right click & click "Export",
then select the whole key name, the press ^C to copy
Then go to vim and press v to run the mapped macro below.
Then go to the filename box and press ^V to paste & click save.
Which looks like:
The macro takes the one line in the clipboard like:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\OpenWithProgids.reg
and converts it to:
HKEY_CURRENT_USER%Software%Microsoft%Windows%CurrentVersion%Explorer%FileExts%.htm%OpenWithProgids.reg
and copies it back to the clipboard.
I was exporting a whole lot of registry entries in Windows.
I would do F3 to find the next match, right click & click "Export",
then select the whole key name, the press ^C to copy
Then go to vim and press v to run the mapped macro below.
Then go to the filename box and press ^V to paste & click save.
:map v dd"+gP^Q:%s/\\/%/g^Q^MV"+y
Which looks like:
:map v dd"+gP^[:%s/\\/%/g^MV"+y
The macro takes the one line in the clipboard like:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\OpenWithProgids.reg
and converts it to:
HKEY_CURRENT_USER%Software%Microsoft%Windows%CurrentVersion%Explorer%FileExts%.htm%OpenWithProgids.reg
and copies it back to the clipboard.
Subscribe to:
Posts (Atom)