顯示具有 [Programming]Ubuntu 標籤的文章。 顯示所有文章
顯示具有 [Programming]Ubuntu 標籤的文章。 顯示所有文章

2016年3月4日 星期五

[Linux] How can I get what my main function has returned

Most shells store the exit code of the previous run command in $? so you can store or display it.
$ ./a.out
$ echo $?     # note - after this command $? contains the exit code of echo!
or
$ ./a.out
$ exit_code=$?    # save the exit code in another shell variable.

[Linux] Checking if a directory exists in Unix (system call)

#include <sys/stat.h>

struct stat sb;

if (stat(pathname, &sb) == 0 && S_ISDIR(sb.st_mode))
{
    ...it is a directory...
}

2013年5月3日 星期五

[Ubuntu] Ubuntu and zypper command

In command:
  .refresh command in screen
    $ clear      

In OpenSSH and chroot
  . reboot device (chroot not support)
    $ reboot   
    $ zypper refresh: update zypper src
    $ zypper search 
    $ zypper install 

P.S. zypper define path:
    /etc/zypp/repo.d/
Others:
command apt zypper
install apt-get install zypper install
remove apt-get remove zypper remove
refresh repository apt-get update zypper refresh
system update apt-get upgrade zypper update
list repository /etc/apt/sources.list zypper repos
add repository /etc/apt/sources.list zypper addrepo
remove repository /etc/apt/sources.list zypper removerepo
search apt-cache search zypper search
search install package  dpkg -l rpm -qa