« first day (1808 days earlier)      last day (1230 days later) » 

7:04 AM
@Queen f hesitantly
 
7:33 AM
@tripleee : (job control) why cant I get CRTL-Y to work ?
#!/bin/bash
sleep 20
read -p "type come crap" Ans
echo "Answer: $Ans"
root@darkstar:~# ./testme
^Z
[1]+  Stopped                 ./testme
root@darkstar:~# fg
./testme
^Ytype come craphello
Answer: hello
root@darkstar:~#
CTRL-Z works but CTRL-Y is not stopping the job when it reads from terminal ...
seems to be ignoring it alltogether
 
8:12 AM
@louigi600 I wasn't even aware that it was supposed to do anything ... it seems to conflict with the yank binding for readline
unix.stackexchange.com/questions/303605/… alleges that it's not enabled on Linux
 
but the script is not interactive so readline is not enabled ... so it is still interacting with the parent shell from which I launched in ter terminal
 
do you see dsusp in the output from stty?
 
no:
test@darkstar:~$ stty
speed 38400 baud; line = 0;
-brkint -imaxbel
test@darkstar:~$
 
looks like it's not even available as an option on Linux
on macOS it is available, but not enabled
 
maybe different
susp CHAR
CHAR will send a terminal stop signal
 
8:18 AM
no that's ctrl-Z
 
I guess I should read the entire stty man age
 
it doesn't really help, the capability you want is not there on Linux
 
this should be stop:

stop CHAR
CHAR will stop the output
 
that's ctrl-S I think
ctrl-Q to continue
but maybe I'm mixing flow control with proper signals
 
let me play a little ... but bash was initially made for linux ... if the bash man page says so linux should be the first it shoud work on
on your mac it workes ?
 
8:25 AM
I haven't tested
Bash far predates Linux
well not very far but it definitely was not "made for Linux"
 
wait maybe ... Stallman commisioned it for GNU userland ... not for linux
it just so happens that linux also uses gnu userland ... technically linux is actually only the kernel and has nothing to do with the userland
 
seems to do what you expected?
$ stty dsusp ^Y
$ cat <<\: >/tmp/scrpt
> #!/bin/bash
> sleep 20
> read -p "type some crap" -r Ans
> echo "Answer: $Ans"
> :
$ bash /tmp/scrpt
^Z
[1]+  Stopped                 bash /tmp/scrpt
$ fg
bash /tmp/scrpt
^Yhello
type some crap
[1]+  Stopped                 bash /tmp/scrpt
$ hello
bash: hello: command not found
there was a long delay before the second Stopped, pretty sure 20 seconds
$ uname -a
Darwin fnord 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
 
the 20 seconds was to give me enough to play with start,stop,bg,fg
 
yeah exactly, just to report on what's not visible from the transcript
$ fg
bash /tmp/scrpt
/tmp/scrpt: line 3: read: read error: 0: Resource temporarily unavailable
Answer:
 
So I should put a note on today's presentation job control chapter
"this featur is not available on linux systems"
 
8:32 AM
being able to paste text (yank) seems much more useful than this obscure feature anyway
 
might remove it altogether ... I can't even think of a real use for it
stop a job that wants to read from terminal so that it will wait untill you are at the terminal and can put it in FG again and deal with the input maybe ?
but read will just sit there untill you type something anyway ... unless you put a timeout on it
 
the linked Unix&Linux post has a number of speculations about what it might be useful for, but none of them are entirely convincing
 
9:23 AM
the one with the most points is actually the least convincing:
"So, the purpose is to type multiple inputs while the first one is being processed, and have the job stop after they are done."

And probably even technically wrong as the job stops while trying to read input not when they are all done.
 
 
7 hours later…
3:54 PM
How can I force the history from a user currently logged in to sync into his .bash_history file ?
 
4:38 PM
Hi,
I have the followign script: #!/bin/bash
i=1
for day in Mon Tue Wed Thu Fri
do
echo "Weekday $(i) : $day"
i=i+1
done
 
@louigi600 something like this? stackoverflow.com/questions/15075523/…
 
The point is that when I try to execute the script says:
./loop3.sh: line 5: i: command not found
Weekday : Mon
./loop3.sh: line 5: i: command not found
Weekday : Tue
./loop3.sh: line 5: i: command not found
Weekday : Wed
./loop3.sh: line 5: i: command not found
Weekday : Thu
./loop3.sh: line 5: i: command not found
Weekday : Fri
 
you need arithmetit expansuin to do the increment
 
And I dont understand why because I have outside the loop declared the "i" variable. It should increase it value inside of the loop
 
but no need to do that with the for loop you are using
let me correct that for you
 
4:42 PM
of course lougi fell free
arithmethic expansion is not 'i++' or 'i=i+1' ?
 
@lanz no, it looks like i=$((i+1))
but perhaps it would be more elegant to do something like printf '%s\n' Mon Tue Wed Thu Fri Sat Sun | nl
 
for day in Mon Tue Wed Thu Fri
do
echo "Weekday $i : $day"
((i++))
done
 
Sure, but I am just learning scripting so, that`s why I wanted to understand this concept
 
forgot the initial
i=1
that works on my own active shell
I want to force another active user to sync his history into his history file (from root user)
 
Ok thanks
 
5:01 PM
Hi I am little bit stuck here on allowing permission for a storage directory in linux container while building it. I don't know the proper way of adding permission to the directory. Because of this the application is not running.
I am using docker container for php-fpm
 
arithmetic expansion as per bash man page
it can make a bash for loop look nearly like a C one
for ((i=0;i<10;i++))
do
echo $i
done
The double round brackets tells bash you want arithmetic exansion
@astrosixer Inside the container you change permissions to files and folders just like a normal linux ... but be warned that once you stop the container you may loose your chages
if you want to permanently change the container image ... that's a different story
 
It tried to change it while the container is running but it shows operation not permitted
 
what user are you ?
do you have the sufficient privileges to do that ?
is the immutable flag set ?
 
last thing I tried is
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
but I am getting warning of user directive is ignored when php-fpm is not run as root
 
looks like you are doing that from the host and not from the container
 
5:11 PM
I am running docker containers using docker-compose.yml file
And building the php-fm container from Dockerfile
I entered inside container but still giving the same warning of operation not permitted
 
got to go now
 
Ok bro thanks for the help
 
 
1 hour later…
 
2 hours later…
8:50 PM
@Queen k
@astrosixer sounds like a PHP problem then, which user are you running as?
 
I just changed the directory it worked
I didn't understand what happened
Anyway can I ask how will we find the user?
Because in those situations i tried running chown commands inside the php container but it doesn't at all running. Instead give me operation not permitted warning message
Even the 'sudo' command also not available why?
 

« first day (1808 days earlier)      last day (1230 days later) »