Dynamically allocate array of 2 pointers to functions returning int and taking no argument.
|
int test1() {printf "test1"; return 0;} int test2() {printf "test2"; return 0;} int main(int argc, char* argv[]) { int (*(*f_arr))() = malloc(sizeof(int (*)()) * 2); f_arr[0] = &test1; f_arr[1] = &test1; } |
Statically allocate array of 2 pointers to functions returning int and taking no argument.
|
int test1() {printf "test1"; return 0;} int test2() {printf "test2"; return 0;} int main(int argc, char* argv[]) { int (*f_arr[2])() = {test1, test2}; return testRunner(f_arr, 2); } |
… Read more »
Create group for your user
Add user to group
|
usermod -G my_group my_user |
Change user’s password
Now let’s make this user sudoer. Create a new file /etc/sudoers.d/my_sudoers To configure specific user… Read more »
The problem Let’s say we have two scripts, /foo/bar/utils.sh
|
function do_something_useful { echo "Hello $1" } |
and script /foo/bar/main.sh, in which you want to use function do_something_useful from utils.sh. The common incorrect answer You can easily… Read more »
Command eval is builtin shell builtin, part of POSIX. In practice, eval takes a string as argument and evaluates that string as if you would typed it if it was… Read more »
Goal The goal of this blog is to describe steps to reach following state. I want to run CentOS7 box in Vagrant using VirtualBox Vagrant provider. I want to… Read more »
The problem Here is description of imaginary situation we want to solve. You have access via SSH to server server with hostname foobar-server. The foobar-server is running some service –… Read more »