The more recent one is a subset. The earlier one asks an additional question. But yes, I think the more recent one can be closed as a dupe of the earlier one.
Well, the older one says how would I find out via a shell script, while the newer one just says how would i find out. So they are not exactly dupes. But similar enough to be merged, maybe? Holding off voting for now.