Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jul 2014 02:38:53 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Ralf Mardorf <ralf.mardorf@rocketmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: [Bulk] Re: The name "grep"
Message-ID:  <20140708023853.f30f34b9.freebsd@edvax.de>
In-Reply-To: <1404754241.815.1.camel@archlinux>
References:  <20140707075443.d47ca06a.freebsd@edvax.de> <53BA4F77.60907@qeng-ho.org> <20140707104403.5a0694ff.freebsd@edvax.de> <53BA71A7.9040208@qeng-ho.org> <1404728392.19389.1.camel@archlinux> <53BA9EC0.9000201@qeng-ho.org> <20140707160528.7ecf9855.freebsd@edvax.de> <1404750481.19389.12.camel@archlinux> <53BAD236.3060501@qeng-ho.org> <1404754241.815.1.camel@archlinux>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 07 Jul 2014 19:30:41 +0200, Ralf Mardorf wrote:
> Yes, I agree with "dd [options] -i infile -o outfile" - Polytropon, but
> there's a difference between cp/mv and dd.
> 
> You can not copy or move e.g. a MBR, but you can dd a MBR. A superuser
> could damage the system with mv and cp too, but dd anyway is operating
> on another level.

This is because cp and mv operate on files (on file system level),
in contrast to dd which can _also_ operate on the next lower level
(on device level), which makes it an excellent tool of messing
things up when used with fat fingers. I know this. :-)

An alternative approach would have been to create pseudo-files for
device-level "entities", such as /proc represents processes and
even more. See for example what Plan 9 from Bell Labs did. So
it could be possible to have a file, say /dev/da0.mbr, which
would allow access to the MBR of the first disk:

	% cp /dev/da0.mbr /var/backup/mymbr

The "funny" part starts with

	% rm /dev/da0.mbr
	% mv /dev/da0.parttable /home/bob

because there are much more questions open... :-)



> Sometimes the FreeBSD syntax IMO goes much to far, for example I
> compared ls from FreeBSD and Linux.
> 
> $ uname -a
> FreeBSD freebsd 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
> $ ls -hAl ~/.xsession-errors
> -rw-------  1 rocketmouse  rocketmouse   4.0k Jul  7 19:20 /home/rocketmouse/.xsession-errors
> $ ls .xsession-errors -hAl
> ls: -hAl: No such file or directory
> .xsession-errors
> $

As mentioned before, we see "DOS/JCL positional parameters" here,
as written in "man ls":

	ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1] [-D format] [file ...]

The file argument has to follow the options.



> [rocketmouse@archlinux ~]$ uname -a
> Linux archlinux 3.15.3-1-ARCH #1 SMP PREEMPT Tue Jul 1 07:32:45 CEST 2014 x86_64 GNU/Linux
> [rocketmouse@archlinux ~]$ ls -hAl ~/.xsession-errors
> -rw------- 1 rocketmouse rocketmouse 1.4K Jul  7 19:26 /home/rocketmouse/.xsession-errors
> [rocketmouse@archlinux ~]$ ls .xsession-errors -hAl
> -rw------- 1 rocketmouse rocketmouse 1.4K Jul  7 19:26 .xsession-errors
> [rocketmouse@archlinux ~]$

If you have manpages on that system, just see if "man ls" mentions
something different - obviously the _implementation_ of how program
arguments are being processed is different.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140708023853.f30f34b9.freebsd>