[SOLVED] ?> best way to call another shell from login configuration
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
?> best way to call another shell from login configuration
what is the proper way to call another shell from the current one using shell configuration files
hello, i login to a remote terminal which uses tcsh. If i run /bin/bash by entering the command in the prompt, everything seems ok. if i call it in .cshrc there are problems, though.
I cannot "chsh -s /bin/bash" because "users '...' does not exist in /etc/passwd" . ~/.cshrc is run everytime i login. here's what i tried:
.cshrc :
Code:
cat .cshrc
# @(#)cshrc 1.11 89/11/29 SMI
umask 022
set path=(/home/newapps/SUNWspro/bin /home/appl/gcc/bin /home/appl/gdb/bin /usr/ccs/bin /usr/bin/X11 /bin /usr/bin /home/appl/mosaic /usr/ucb /etc /usr/etc /usr/local/bin /home/appl/emacs/bin /home/appl/ghostscript/bin /home/appl/gzip/bin .)
if ( $?prompt ) then
setenv LC_CTYPE el_GR.utf8
stty cs8 -istrip -parenb
set history=32
endif
alias cd 'cd \!*; set prompt = `hostname`\:$cwd\>'
alias ls 'ls -lF'
#alias rm 'rm -i'
alias lo 'logout'
alias mail '/usr/ucb/mail'
set prompt = `hostname`\:$cwd\>
set filec
limit coredumpsize 0
# editted after this line:
# 1st try
tty --quiet && exec /bin/bash #also with --login
# also tried (2nd try)
#tty --quiet && /bin/bash #also with --login
the problem is found in cgdb with a sample small program called main.c .
cgdb ./main (1st try):
Code:
(gdb) run
Starting program: /home/users1/sdi1500122/ip/lab-2015.12.18/main
Cannot access memory at address 0xea6bd464
Cannot access memory at address 0xea6bd460
(gdb)
(2nd try) when i hit "run" i get
Code:
(gdb) run
Starting program: /home/users1/sdi1500122/ip/lab-2015.12.18/main sdi1500122@linux27:~/ip/lab-2015.12.18$
in the 2nd try, i cannot <Ctrl>+C or "quit". I can however <Ctrl>+Z and kill it with pkill -KILL cgdb.
Here's the program used (for reference):
Code:
cat main.c
#include <stdio.h>
#define N 5
int main(void){
int i,j,arr[N][N];
for (i=0; i < N; i++){
for (j=0; j < N; j++){
if ( i == j )
arr[i][j] = 1;
else
arr[i][j] = 0;
}
}
for (i=0; i < N; i++){
for (j=0; j < N; j++){
printf("%i ",arr[i][j]);
}
printf("\n");
}
/* int (*i)[10];
printf("%x\n",i);
int *j[10];
printf("%x\n",j);
*/ return 0;
}
If you suspect it is related to gdb /cgdb only, please let me search for it:
Code:
cgdb:
CGDB 0.6.5
gdb:
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
ubuntu:
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"
tcsh:
tcsh 6.17.06 (Astron) 2011-04-15 (i686-intel-linux) options wide,nls,dl,al,kan,rh,nd,color,filec
bash:
GNU bash, version 4.2.25(1)-release (i686-pc-linux-gnu)
#
ulimit -a # in bash
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 15990
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 15990
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
what is the proper way to call another shell from the current one using shell configuration files
hello, i login to a remote terminal which uses tcsh. If i run /bin/bash by entering the command in the prompt, everything seems ok. if i call it in .cshrc there are problems, though.
I cannot "chsh -s /bin/bash" because "users '...' does not exist in /etc/passwd" .
Is '...' the account under which you log in?
Can you read /etc/passwd?
Can you run chsh -s /bin/bash whateveruseryouareloggedinas?
And perhaps post the result of the id command and the exact error message of chsh.
Quote:
Originally Posted by tsester
~/.cshrc is run everytime i login. here's what i tried:
.cshrc :
Code:
cat .cshrc
# @(#)cshrc 1.11 89/11/29 SMI
umask 022
set path=(/home/newapps/SUNWspro/bin /home/appl/gcc/bin /home/appl/gdb/bin /usr/ccs/bin /usr/bin/X11 /bin /usr/bin /home/appl/mosaic /usr/ucb /etc /usr/etc /usr/local/bin /home/appl/emacs/bin /home/appl/ghostscript/bin /home/appl/gzip/bin .)
if ( $?prompt ) then
setenv LC_CTYPE el_GR.utf8
stty cs8 -istrip -parenb
set history=32
endif
alias cd 'cd \!*; set prompt = `hostname`\:$cwd\>'
alias ls 'ls -lF'
#alias rm 'rm -i'
alias lo 'logout'
alias mail '/usr/ucb/mail'
set prompt = `hostname`\:$cwd\>
set filec
limit coredumpsize 0
# editted after this line:
# 1st try
tty --quiet && exec /bin/bash #also with --login
# also tried (2nd try)
#tty --quiet && /bin/bash #also with --login
I don't see bash called.
The rest of your post seems to have nothing to do with your problem.
Quote:
Originally Posted by tsester
the problem is found in cgdb with a sample small program called main.c .
cgdb ./main (1st try):
Code:
(gdb) run
Starting program: /home/users1/sdi1500122/ip/lab-2015.12.18/main
Cannot access memory at address 0xea6bd464
Cannot access memory at address 0xea6bd460
(gdb)
(2nd try) when i hit "run" i get
Code:
(gdb) run
Starting program: /home/users1/sdi1500122/ip/lab-2015.12.18/main sdi1500122@linux27:~/ip/lab-2015.12.18$
in the 2nd try, i cannot <Ctrl>+C or "quit". I can however <Ctrl>+Z and kill it with pkill -KILL cgdb.
Here's the program used (for reference):
Code:
cat main.c
#include <stdio.h>
#define N 5
int main(void){
int i,j,arr[N][N];
for (i=0; i < N; i++){
for (j=0; j < N; j++){
if ( i == j )
arr[i][j] = 1;
else
arr[i][j] = 0;
}
}
for (i=0; i < N; i++){
for (j=0; j < N; j++){
printf("%i ",arr[i][j]);
}
printf("\n");
}
/* int (*i)[10];
printf("%x\n",i);
int *j[10];
printf("%x\n",j);
*/ return 0;
}
If you suspect it is related to gdb /cgdb only, please let me search for it:
Code:
cgdb:
CGDB 0.6.5
gdb:
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
ubuntu:
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"
tcsh:
tcsh 6.17.06 (Astron) 2011-04-15 (i686-intel-linux) options wide,nls,dl,al,kan,rh,nd,color,filec
bash:
GNU bash, version 4.2.25(1)-release (i686-pc-linux-gnu)
#
ulimit -a # in bash
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 15990
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 15990
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
it probably is. that's why your username isn't in /etc/passwd and chsh doesn't work. the -l flag doesn't work tacked onto the line you said worked earlier?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.