It's not something I'd expect. A shell deals with plumbing together programs and files, which are an abstraction over the actual raw filesystem (which is exposed by the kernel). For a shell to do true snapshots, it'd have to talk to the underlying filesystem. In theory this is possible I guess, but then your "shell" needs to be the compatible with the filesystem you're in, which is a very weird situation.
IMO a much better way to go about it would be to encode filesystem operations inside a monad. Then you could chain together filesystem operations to make up some sort of transformation, then after it's built up apply the operations to the real filesystem. It achieves something similar, but doesn't require any sort of filesystem support.
You can manually get filesystem snapshots with say `btrfs subvolume snapshot`, but the shell doesn't care about that. It doesn't ever deal with the filesystem directly, it either asks the kernel to do something or calls a program that asks the kernel to do something. To draw an analogy to databases (which are usually essentially based on immutable data structures in the sense that they're transactional), this would be like asking the postgresql command line client to handle making sure that the actual database manipulations are done transactionally. It doesn't quite make sense, that sort of business belongs in the postgresql server (which would be the OS kernel in our analogy here).
IMO a much better way to go about it would be to encode filesystem operations inside a monad. Then you could chain together filesystem operations to make up some sort of transformation, then after it's built up apply the operations to the real filesystem. It achieves something similar, but doesn't require any sort of filesystem support.
You can manually get filesystem snapshots with say `btrfs subvolume snapshot`, but the shell doesn't care about that. It doesn't ever deal with the filesystem directly, it either asks the kernel to do something or calls a program that asks the kernel to do something. To draw an analogy to databases (which are usually essentially based on immutable data structures in the sense that they're transactional), this would be like asking the postgresql command line client to handle making sure that the actual database manipulations are done transactionally. It doesn't quite make sense, that sort of business belongs in the postgresql server (which would be the OS kernel in our analogy here).