Halachah · Shulchan Aruch
Shulchan Arukh, Orach Chayim 344/שולחן ערוך· אורח חיים שמ״ד
אדין ההולך במדבר בשבת. ובו ב סעיפים:
ההולך במדבר ואינו יודע מתי הוא שבת מונה שבעה ימים מיום שנתן אל לבו שכחתו ומקדש השביעי בקידוש והבדלה ואם יש לו ממה להתפרנס אסור לו לעשות מלאכה כלל עד שיכלה מה שיש לו ואז יעשה מלאכה בכל יום אפילו ביום שמקדש בו כדי פרנסתו מצומצמת ומותר לילך בו בכל יום אפי' ביום שמקדש בו:
ההולך במדבר ואינו יודע מתי הוא שבת מונה שבעה ימים מיום שנתן אל לבו שכחתו ומקדש השביעי בקידוש והבדלה ואם יש לו ממה להתפרנס אסור לו לעשות מלאכה כלל עד שיכלה מה שיש לו ואז יעשה מלאכה בכל יום אפילו ביום שמקדש בו כדי פרנסתו מצומצמת ומותר לילך בו בכל יום אפי' ביום שמקדש בו:
1The Law of Someone Who Is Wandering in the Desert on Shabbat. Contains 2 Seifim: One who is wandering in the desert and does not when is Shabbat, counts seven days from the day he realized he did not know, and sanctifies the seventh day with Kiddush and Havdalah. If one has sustenance, one is forbidden from doing any work whatsoever until he uses what he has, and thereafter one should do work each day, even on the day he sanctifies, to achieve minimal sustenance. One is permitted to walk every day, even on the day he sanctifies.
בהיה יודע מנין יום שיצא בו כגון שיודע שהיום יום רביעי או יום חמישי ליציאתו אבל אינו יודע באיזו יום יצא מותר לעשות מלאכה כל מה שירצה ביום שמיני ליציאתו שביום כזה יצא מביתו דבודאי לא יצא בשבת וכן ביום ט"ו וביום כ"ב וכן לעולם:
2If he knows how many days he has been walking, i.e. he knows that today is the fourth day or the fifth day since his departure, but he does not know on which day he left, he is permitted to do as much work as he wants on the eighth day since his departure, because on that day of the week he left his house, and he certainly did not leave on Shabbat, and so too on the fifteenth day and the twenty-second day, and so on.