diff --git a/tests/profiles.scm b/tests/profiles.scm
index a39717191dc1c2f94b97e47f959dddc9d6f7a3e2..de1411dca2b5ab97ac4d27f9ae14d91128a61666 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -237,14 +237,16 @@ (define glibc
     (mbegin %store-monad
       (built-derivations (list drv))
       (let* ((pipe (open-input-pipe
-                    (string-append "source "
-                                   profile "/etc/profile; "
-                                   "unset GUIX_PROFILE; set")))
-             (env  (get-string-all pipe)))
+                    (string-append "unset GUIX_PROFILE; "
+                                   ;; 'source' is a Bashism; use '.' (dot).
+                                   ". " profile "/etc/profile; "
+                                   ;; Don't try to parse set(1) output because
+                                   ;; it differs among shells; just use echo.
+                                   "echo $PATH")))
+             (path (get-string-all pipe)))
         (return
          (and (zero? (close-pipe pipe))
-              (string-contains env
-                               (string-append "PATH=" profile "/bin"))))))))
+              (string-contains path (string-append profile "/bin"))))))))
 
 (test-end "profiles")