1310 |
the variables @code{tramp-actions-before-shell} and |
the variables @code{tramp-actions-before-shell} and |
1311 |
@code{tramp-multi-actions} (for multi-hop connections). |
@code{tramp-multi-actions} (for multi-hop connections). |
1312 |
|
|
1313 |
|
@item Non-Bourne commands in @file{.profile} |
1314 |
|
|
1315 |
|
After logging in to the remote host, @tramp{} issues the command |
1316 |
|
@code{exec /bin/sh}. (Actually, the command is slightly different.) |
1317 |
|
When @code{/bin/sh} is executed, it reads some init files, such as |
1318 |
|
@file{~/.shrc} or @file{~/.profile}. |
1319 |
|
|
1320 |
|
Now, some people have a login shell which is not @code{/bin/sh} but a |
1321 |
|
Bourne-ish shell such as bash or ksh. Some of these people might put |
1322 |
|
their shell setup into the files @code{~/.shrc} or @code{~/.profile}. |
1323 |
|
This way, it is possible for non-Bourne constructs to end up in those |
1324 |
|
files. Then, @code{exec /bin/sh} might cause the Bourne shell to barf |
1325 |
|
on those constructs. |
1326 |
|
|
1327 |
|
As an example, imagine somebody putting @code{export FOO=bar} into the |
1328 |
|
file @file{~/.profile}. The standard Bourne shell does not understand |
1329 |
|
this syntax and will emit a syntax error when it reaches this line. |
1330 |
|
|
1331 |
|
What can you do about this? |
1332 |
|
|
1333 |
|
Well, one possibility is to make sure that everything in @file{~/.shrc} |
1334 |
|
and @file{~/.profile} on all remote hosts is Bourne-compatible. In the |
1335 |
|
above example, instead of @code{export FOO=bar}, you might use |
1336 |
|
@code{FOO=bar; export FOO} instead. |
1337 |
|
|
1338 |
|
The other possibility is to put your non-Bourne shell setup into some |
1339 |
|
other files. For example, bash reads the file @file{~/.bash_profile} |
1340 |
|
instead of @file{~/.profile}, if the former exists. So bash |
1341 |
|
aficionados just rename their @file{~/.profile} to |
1342 |
|
@file{~/.bash_profile} on all remote hosts, and Bob's your uncle. |
1343 |
|
|
1344 |
|
The @tramp{} developers would like to circumvent this problem, so if you |
1345 |
|
have an idea about it, please tell us. However, we are afraid it is not |
1346 |
|
that simple: before saying @code{exec /bin/sh}, @tramp{} does not know |
1347 |
|
which kind of shell it might be talking to. It could be a Bourne-ish |
1348 |
|
shell like ksh or bash, or it could be a csh derivative like tcsh, or |
1349 |
|
it could be zsh, or even rc. If the shell is Bourne-ish already, then |
1350 |
|
it might be prudent to omit the @code{exec /bin/sh} step. But how to |
1351 |
|
find out if the shell is Bourne-ish? |
1352 |
|
|
1353 |
@end table |
@end table |
1354 |
|
|
1355 |
|
|